Começando com a versão 1.0.28
BackInTime suporte udev
agendamentos por conta própria. Basta selecionar When drive get connected (udev)
em Settings > Schedule
e pronto ...
Disclaimer: Eu sou o principal dev atual do BIT
Na verdade, já respondi a essa pergunta, embora não saiba se a resposta é boa. Então, o que você acha sobre isso:
#!/bin/bash
# usage: backup_userdata.sh username
export _USER=$1
# config file, Xauthoriy and DISPLAY
export BIT_CONFIG=/home/$_USER/.config/backintime/config
if ! test -e $BIT_CONFIG ; then exit 1;fi
# set DISPLAY
export XAUTHORITY=/home/$_USER/.Xauthority
export $(cat /proc/$(pgrep -o -u $_USER unity)/environ | tr '#!/bin/bash
# usage: backup_userdata.sh username
export _USER=$1
# config file, Xauthoriy and DISPLAY
export BIT_CONFIG=/home/$_USER/.config/backintime/config
if ! test -e $BIT_CONFIG ; then exit 1;fi
# set DISPLAY
export XAUTHORITY=/home/$_USER/.Xauthority
export $(cat /proc/$(pgrep -o -u $_USER unity)/environ | tr '%pre%' '\n' | grep '^DISPLAY=').0
# dont auto-open backup USB disk - couldnt find a better solution for this
su $_USER -c 'gsettings set org.gnome.desktop.media-handling automount-open false'
{ sleep 10; su $_USER -c 'gsettings set org.gnome.desktop.media-handling automount-open true' ; }&
# send the rest to the background so udev doesnt wait for the backup to end
{
export BIT_LOG=/home/$_USER/.local/share/backintime/takesnapshot_.log
# strings for pop ups
export STARTTEXT="Backup started"
export SUCCESSTEXT="Backup completed"
export WARNINGTEXT="Backup completed with errors\nRevise results\nExternal disk still mounted"
export ERRORTEXT="Backup aborted\nRevise results\nExternal disk still mounted"
export BIT="Back In Time"
# back up media
export BIT_MEDIA="/media/backup"
# start backup
su $_USER -c 'notify-send "$BIT" "$STARTTEXT"'
if su $_USER -c 'backintime -b --config $BIT_CONFIG'; then
if ! grep -iq "error: " $BIT_LOG; then
# no errors in log file
umount $BIT_MEDIA # umount before confirmation
su $_USER -c 'notify-send "$BIT" "$SUCCESSTEXT"'
su $_USER -c 'zenity --no-wrap --info --title "$BIT" --text "\n$SUCCESSTEXT"'
else
# errors in log file
su $_USER -c 'notify-send "$BIT" "$WARNINGTEXT"'
su $_USER -c 'zenity --no-wrap --warning --title "$BIT" --text "\n$WARNINGTEXT"'
su $_USER -c backintime-gnome # open BIT for error analysis
fi
else
# backup aborted
su $_USER -c 'notify-send "$BIT" "$ERRORTEXT"'
su $_USER -c 'zenity --no-wrap --error --title "$BIT" --text "\n$ERRORTEXT"'
su $_USER -c backintime-gnome # open BIT for error analysis
fi
}&
' '\n' | grep '^DISPLAY=').0
# dont auto-open backup USB disk - couldnt find a better solution for this
su $_USER -c 'gsettings set org.gnome.desktop.media-handling automount-open false'
{ sleep 10; su $_USER -c 'gsettings set org.gnome.desktop.media-handling automount-open true' ; }&
# send the rest to the background so udev doesnt wait for the backup to end
{
export BIT_LOG=/home/$_USER/.local/share/backintime/takesnapshot_.log
# strings for pop ups
export STARTTEXT="Backup started"
export SUCCESSTEXT="Backup completed"
export WARNINGTEXT="Backup completed with errors\nRevise results\nExternal disk still mounted"
export ERRORTEXT="Backup aborted\nRevise results\nExternal disk still mounted"
export BIT="Back In Time"
# back up media
export BIT_MEDIA="/media/backup"
# start backup
su $_USER -c 'notify-send "$BIT" "$STARTTEXT"'
if su $_USER -c 'backintime -b --config $BIT_CONFIG'; then
if ! grep -iq "error: " $BIT_LOG; then
# no errors in log file
umount $BIT_MEDIA # umount before confirmation
su $_USER -c 'notify-send "$BIT" "$SUCCESSTEXT"'
su $_USER -c 'zenity --no-wrap --info --title "$BIT" --text "\n$SUCCESSTEXT"'
else
# errors in log file
su $_USER -c 'notify-send "$BIT" "$WARNINGTEXT"'
su $_USER -c 'zenity --no-wrap --warning --title "$BIT" --text "\n$WARNINGTEXT"'
su $_USER -c backintime-gnome # open BIT for error analysis
fi
else
# backup aborted
su $_USER -c 'notify-send "$BIT" "$ERRORTEXT"'
su $_USER -c 'zenity --no-wrap --error --title "$BIT" --text "\n$ERRORTEXT"'
su $_USER -c backintime-gnome # open BIT for error analysis
fi
}&
O scipt funciona. O único problema que resta, até onde eu posso ver, é que a versão do BIT que eu estou rodando no meu 12.04 nem sempre usa um status de saída. Mas a versão mais recente deve fazer (não posso testá-lo no momento).
Algum comentário?
"*" Fator de aceitação da mulher
Começando com a versão 1.0.28
BackInTime suporte udev
agendamentos por conta própria. Basta selecionar When drive get connected (udev)
em Settings > Schedule
e pronto ...
Disclaimer: Eu sou o principal dev atual do BIT