From 79a200cbb460d69b58f025da70b0e3753a227a5e Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 19 Jan 2014 02:26:54 +0100 Subject: Added support for backing up, while psd is running --- bin/backup-profiles | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/backup-profiles b/bin/backup-profiles index 5ee9b3c..57a7d03 100755 --- a/bin/backup-profiles +++ b/bin/backup-profiles @@ -5,8 +5,10 @@ thunderbirdPID=`ps -C thunderbird -o pid=` firefoxTMP=/tmp/firefox.tgz thunderbirdTMP=/tmp/thunderbird.tgz -firefoxIF=~/.mozilla/firefox/dvzrv -thunderbirdIF=~/.thunderbird/dvzrv +firefoxIF=~/.mozilla/firefox/ +thunderbirdIF=~/.thunderbird/ +profileName=dvzrv +backupEND=-backup OF=~/Dropbox/sync gpgEND=.gpg @@ -15,7 +17,7 @@ if [[ -z "$firefoxPID" ]] then echo "Firefox is not running." echo "Backing up profile." - tar cfPzh $firefoxTMP $firefoxIF + tar cfPzh $firefoxTMP -C $firefoxIF $profileName echo "Encrypting profile." gpg -e -r 'David Runge ' $firefoxTMP echo "Moving backup to Dropbox." @@ -25,7 +27,20 @@ then echo "Done." else echo "Firefox is still running." - echo "Skipping backup." + psdStopped=`systemctl status |grep inactive` + if [[ ! -z "$psdStopped" ]]; then + echo "psd service running. Trying to use its backup." + tar cfPzh $firefoxTMP -C $firefoxIF "$profileName$backupEND" + echo "Encrypting profile." + gpg -e -r 'David Runge ' $firefoxTMP + echo "Moving backup to Dropbox." + mv -f $firefoxTMP$gpgEND $OF + echo "Cleaning up." + rm $firefoxTMP + echo "Done." + else + echo "Skipping backup." + fi fi if [[ -z "$thunderbirdPID" ]] -- cgit v1.2.3-54-g00ecf