Pelican blog backups

This commit is contained in:
Bob Mottram 2017-03-26 11:31:21 +01:00
parent bfeb35c89f
commit 1b9d528ed6
1 changed files with 76 additions and 4 deletions

View File

@ -123,19 +123,91 @@ function upgrade_pelican {
}
function backup_local_pelican {
echo -n ''
source_directory=/etc/blog
if [ -d $source_directory ]; then
dest_directory=pelican
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
fi
source_directory=/var/www/$PELICAN_BLOG_DOMAIN/htdocs
if [ -d $source_directory ]; then
dest_directory=pelican-site
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
fi
}
function restore_local_pelican {
echo -n ''
if [ -d /etc/blog ]; then
if [ -d $USB_MOUNT_DLNA/backup/pelican ]; then
temp_restore_dir=/root/temppelican
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir pelican
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit 527942
fi
rm -rf $temp_restore_dir
fi
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
if [ -d $USB_MOUNT_DLNA/backup/pelican-site ]; then
temp_restore_dir=/root/temppelican-site
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir pelican-site
cp -r $temp_restore_dir/var/www/$PELICAN_BLOG_DOMAIN/htdocs/* /var/www/$PELICAN_BLOG_DOMAIN/htdocs/
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
function_check set_user_permissions
set_user_permissions
function_check backup_unmount_drive
backup_unmount_drive
exit 2946282
fi
rm -rf $temp_restore_dir
fi
fi
}
function backup_remote_pelican {
echo -n ''
if [ -d /etc/blog ]; then
backup_directory_to_friend /etc/blog pelican
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
backup_directory_to_friend /var/www/$PELICAN_BLOG_DOMAIN/htdocs pelican-site
fi
}
function restore_remote_pelican {
echo -n ''
if [ -d /etc/blog ]; then
if [ -d $SERVER_DIRECTORY/backup/pelican ]; then
temp_restore_dir=/root/temppelican
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir pelican
cp -r $temp_restore_dir/etc/blog/* /etc/blog/
if [ ! "$?" = "0" ]; then
exit 782352
fi
rm -rf $temp_restore_dir
fi
fi
if [ -d /var/www/$PELICAN_BLOG_DOMAIN/htdocs ]; then
if [ -d $SERVER_DIRECTORY/backup/pelican-site ]; then
temp_restore_dir=/root/temppelican-site
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir pelican-site
cp -r $temp_restore_dir/var/www/$PELICAN_BLOG_DOMAIN/htdocs/* /var/www/$PELICAN_BLOG_DOMAIN/htdocs/
if [ ! "$?" = "0" ]; then
exit 76382562
fi
rm -rf $temp_restore_dir
fi
fi
}
function remove_pelican {