From 89b1dd29d1e26930bcc6f99b9d845a173452245f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 24 Sep 2015 22:25:23 +0100 Subject: [PATCH] Tidying remote backup script --- src/freedombone | 189 ++++++++++++++++++++++++++---------------------- 1 file changed, 101 insertions(+), 88 deletions(-) diff --git a/src/freedombone b/src/freedombone index 1527a973..60a07b52 100755 --- a/src/freedombone +++ b/src/freedombone @@ -3749,67 +3749,75 @@ function create_freedns_updater { } function backup_directory_to_friend { + echo 'function backup_directory_to_friend {' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo " MY_NAME=$MY_NAME" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo " BACKUP_CERTIFICATE=$BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo " MY_EMAIL_ADDRESS=$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME if [[ $BACKUP_TYPE == 'obnam' ]]; then - BACKUP_KEY_EXISTS=$(gpg --list-keys "$MY_NAME (backup key)") - if [ ! "$?" = "0" ]; then - echo "Backup key could not be found" - exit 43382 - fi - MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}') + echo ' BACKUP_KEY_EXISTS=$(gpg --list-keys "$MY_NAME (backup key)")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' echo "Backup key could not be found"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' exit 43382' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | grep "pub " | awk -F " " "{print $2}" | awk -F "/" "{print $2}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n 'obnam backup -r $SERVER_DIRECTORY/backup/ ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "--encrypt-with $MY_BACKUP_KEY_ID " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "${2} ${1}" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' obnam backup -r $SERVER_DIRECTORY/backup/ ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '--encrypt-with $MY_BACKUP_KEY_ID ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '${2} ${1}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME else # For rsyncrypto usage see http://archive09.linux.com/feature/125322 - echo -n "rsyncrypto -v -r ${1} " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' rsyncrypto -v -r ${1} ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n '$SERVER_DIRECTORY/backup/' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n "${2} " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n '${2} ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo -n '$SERVER_DIRECTORY/backup/' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - fi - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then - echo " shred -zu /root/temp${2}/*" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " rm -rf /root/temp${2}" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - fi - echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n " echo \"Unable to backup ${2}\" | mail -s \"Freedombone backup to friends\" " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' exit 853' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then - echo "shred -zu /root/temp${2}/*" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "rm -rf /root/temp${2}" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '${2}.keys $BACKUP_CERTIFICATE' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi + echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' shred -zu /root/temp${2}/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' rm -rf /root/temp${2}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' echo "Unable to backup ${2}" | mail -s "Freedombone backup to friends" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '$MY_EMAIL_ADDRESS' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' exit 853' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' shred -zu /root/temp${2}/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' rm -rf /root/temp${2}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME } function backup_database_to_friend { - echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -d $SERVER_DIRECTORY/backup/${1} ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " mkdir -p $SERVER_DIRECTORY/backup/${1}" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -d $SERVER_DIRECTORY/backup/${1}data ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " mkdir -p $SERVER_DIRECTORY/backup/${1}data" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -d /root/temp${1}data ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " mkdir -p /root/temp${1}data" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "echo \"Obtaining ${1} database backup\"" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo 'mysqldump --password=$DATABASE_PASSWORD ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "${1} > /root/temp${1}data/${1}.sql" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "if [ ! -s /root/temp${1}data/${1}.sql ]; then" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " echo \"${1} database could not be saved\"" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " echo 'No MariaDB password was given'" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " fi" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " shred -zu /root/temp${1}data/*" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo " rm -rf /root/temp${1}data" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo -n " echo \"Unable to export ${1} database\" | mail -s \"Freedombone backup to friends\" " >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo ' exit 5738' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - echo "fi" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'function backup_database_to_friend {' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo " DATABASE_PASSWORD=$DATABASE_PASSWORD" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo " MY_EMAIL_ADDRESS=$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! -d $SERVER_DIRECTORY/backup/${1} ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' mkdir -p $SERVER_DIRECTORY/backup/${1}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! -d $SERVER_DIRECTORY/backup/${1}data ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' mkdir -p $SERVER_DIRECTORY/backup/${1}data' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! -d /root/temp${1}data ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' mkdir -p /root/temp${1}data' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' echo "Obtaining ${1} database backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' mysqldump --password=$DATABASE_PASSWORD ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '${1} > /root/temp${1}data/${1}.sql' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! -s /root/temp${1}data/${1}.sql ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' echo "${1} database could not be saved"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' if [ ! $DATABASE_PASSWORD ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' echo "No MariaDB password was given"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' shred -zu /root/temp${1}data/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' rm -rf /root/temp${1}data' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo -n ' echo "Unable to export ${1} database" | mail -s "Freedombone backup to friends" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '$MY_EMAIL_ADDRESS' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' exit 5738' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo '}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME } function backup_to_friends_servers { @@ -3882,20 +3890,25 @@ function backup_to_friends_servers { echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + backup_directory_to_friend + echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + backup_database_to_friend + echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + if grep -Fxq "install_gnu_social" $COMPLETION_FILE; then BACKUP_INCLUDES_DATABASES="yes" - backup_database_to_friend gnusocial - backup_directory_to_friend '/root/tempgnusocialdata' 'gnusocialdata' + echo 'backup_database_to_friend gnusocial' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /root/tempgnusocialdata gnusocialdata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Backing up GNU social installation"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend "/var/www/$MICROBLOG_DOMAIN_NAME/htdocs" 'gnusocial' + echo "backup_directory_to_friend /var/www/$MICROBLOG_DOMAIN_NAME/htdocs gnusocial" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then BACKUP_INCLUDES_DATABASES="yes" - backup_database_to_friend hubzilla - backup_directory_to_friend '/root/temphubzilladata' 'hubzilladata' + echo 'backup_database_to_friend hubzilla' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /root/temphubzilladata hubzilladata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Backing up Hubzilla installation"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend "/var/www/$HUBZILLA_DOMAIN_NAME/htdocs" 'hubzilla' + echo 'backup_directory_to_friend /var/www/$HUBZILLA_DOMAIN_NAME/htdocs hubzilla' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi if grep -Fxq "install_owncloud" $COMPLETION_FILE; then @@ -3903,11 +3916,11 @@ function backup_to_friends_servers { echo 'if [ ! -d $SERVER_DIRECTORY/backup/owncloud2 ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/owncloud2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_database_to_friend owncloud - backup_directory_to_friend '/root/tempownclouddata' 'ownclouddata' + echo 'backup_database_to_friend owncloud' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /root/tempownclouddata ownclouddata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining Owncloud data backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/var/lib/owncloud' 'owncloud' - backup_directory_to_friend '/etc/owncloud' 'owncloud2' + echo 'backup_directory_to_friend /var/lib/owncloud owncloud' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /etc/owncloud owncloud2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi @@ -3919,16 +3932,16 @@ function backup_to_friends_servers { echo 'if [ ! -d $SERVER_DIRECTORY/backup/gogsssh ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/gogsssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_database_to_friend gogs - backup_directory_to_friend '/root/tempgogsdata' 'gogsdata' + echo 'backup_database_to_friend gogs' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /root/tempgogsdata gogsdata' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining Gogs settings backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/git/go/src/github.com/gogits/gogs/custom' 'gogs' + echo 'backup_directory_to_friend /home/git/go/src/github.com/gogits/gogs/custom gogs' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining Gogs repos backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo "mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$MY_USERNAME" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/git/gogs-repositories' 'gogsrepos' + echo 'backup_directory_to_friend /home/git/gogs-repositories gogsrepos' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining Gogs authorized_keys backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/git/.ssh' 'gogsssh' + echo 'backup_directory_to_friend /home/git/.ssh gogsssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi @@ -3940,8 +3953,8 @@ function backup_to_friends_servers { echo ' mkdir -p $SERVER_DIRECTORY/backup/wiki2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining wiki data backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/var/lib/dokuwiki' 'wiki' - backup_directory_to_friend '/etc/dokuwiki' 'wiki2' + echo 'backup_directory_to_friend /var/lib/dokuwiki wiki' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME + echo 'backup_directory_to_friend /etc/dokuwiki wiki2' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi if grep -Fxq "install_blog" $COMPLETION_FILE; then @@ -3949,7 +3962,7 @@ function backup_to_friends_servers { echo ' mkdir -p $SERVER_DIRECTORY/backup/blog' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining blog backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend "/var/www/$FULLBLOG_DOMAIN_NAME/htdocs" 'blog' + echo "backup_directory_to_friend /var/www/$FULLBLOG_DOMAIN_NAME/htdocs blog" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then @@ -3957,7 +3970,7 @@ function backup_to_friends_servers { echo ' mkdir -p $SERVER_DIRECTORY/backup/cjdns' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "Obtaining cjdns backup"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/etc/cjdns' 'cjdns' + echo 'backup_directory_to_friend /etc/cjdns cjdns' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi @@ -3968,7 +3981,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/ssl ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/ssl' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/etc/ssl' 'ssl' + echo ' backup_directory_to_friend /etc/ssl ssl' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -3978,7 +3991,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/projects ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/projects' 'projects' + echo ' backup_directory_to_friend /home/$MY_USERNAME/projects projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -3988,7 +4001,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/personal ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/personal' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/personal' 'personal' + echo ' backup_directory_to_friend /home/$MY_USERNAME/personal personal' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -3998,7 +4011,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/mailinglist ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/mailinglist' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend "$PUBLIC_MAILING_LIST_DIRECTORY" 'mailinglist' + echo " backup_directory_to_friend $PUBLIC_MAILING_LIST_DIRECTORY mailinglist" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4008,7 +4021,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/xmpp ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/xmpp' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend "$XMPP_DIRECTORY" 'xmpp' + echo " backup_directory_to_friend $XMPP_DIRECTORY xmpp" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4018,7 +4031,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/gnupg ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/gnupg' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/.gnupg' 'gnupg' + echo ' backup_directory_to_friend /home/$MY_USERNAME/.gnupg gnupg' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4028,7 +4041,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/ssh ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/ssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/.ssh' 'ssh' + echo ' backup_directory_to_friend /home/$MY_USERNAME/.ssh ssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4038,7 +4051,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/web ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/web' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/etc/nginx/sites-available' 'web' + echo ' backup_directory_to_friend /etc/nginx/sites-available web' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4052,7 +4065,7 @@ function backup_to_friends_servers { echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' cp -f /home/$MY_USERNAME/README /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/tempbackup' 'readme' + echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup readme' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4062,7 +4075,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/ipfs ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/ipfs' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/.ipfs' 'ipfs' + echo ' backup_directory_to_friend /home/$MY_USERNAME/.ipfs ipfs' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4079,7 +4092,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/mutt ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/mutt' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/tempbackup' 'mutt' + echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup mutt' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4093,7 +4106,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/procmail ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/procmail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/tempbackup' 'procmail' + echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup procmail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4103,7 +4116,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/spamassassin ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/spamassassin' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/.spamassassin' 'spamassassin' + echo ' backup_directory_to_friend /home/$MY_USERNAME/.spamassassin spamassassin' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4118,7 +4131,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/mail ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/mail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/root/backupemail' 'mail' + echo ' backup_directory_to_friend /root/backupemail mail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4128,7 +4141,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/dlna ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/dlna' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/var/cache/minidlna' 'dlna' + echo ' backup_directory_to_friend /var/cache/minidlna dlna' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4145,7 +4158,7 @@ function backup_to_friends_servers { echo ' if [ ! -d $SERVER_DIRECTORY/backup/voip ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' mkdir -p $SERVER_DIRECTORY/backup/voip' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/home/$MY_USERNAME/tempbackup' 'voip' + echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup voip' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4156,7 +4169,7 @@ function backup_to_friends_servers { echo ' mkdir -p $SERVER_DIRECTORY/backup/tox' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo ' cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/var/lib/tox-bootstrapd' 'tox' + echo ' backup_directory_to_friend /var/lib/tox-bootstrapd tox' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME @@ -4179,7 +4192,7 @@ function backup_to_friends_servers { echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'echo "$DATABASE_PASSWORD" > /root/tempmariadb/db' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo 'chmod 400 /root/tempmariadb/db' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME - backup_directory_to_friend '/root/tempmariadb' 'mariadb' + echo 'backup_directory_to_friend /root/tempmariadb mariadb' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME fi