• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Hosting-new.com

Hébergement web, cloud et solutions personnalisées

  • Home
  • About

Hébergement CPanel sur SSD, offre Cloud

Un hébergement professionnel sur serveur Xeon Gold et SSD

backup

Centralized Backup Script

January 10, 2020 by Admin Leave a Comment

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Hello There!

I thought I’d share a backup script that was written to consolidate backups onto one server instead of spreading the backup process across several servers. The advantages are somewhat obvious to consolidating the script onto one server, namely being that editing or making changes is much easier as you only have one script to edit.

The environment where this may be ideal would be for environments with 15-20 servers or less. I’d recommend a complete end-to-end backup solution for servers that exceed that number such as Bacula perhaps.

The bash shell script that I pasted below is very straightforward and takes two arguments. The first is the hostname or ip address of the destination server you are backing up. The next (and potentially unlimited) arguments will be single quote encased folders which you would want backed up.

This script is dependent on the server the script is running on having ssh key based authentication enabled and implemented for the root user. Security considerations can be made with IP based restrictions either in the ssh configuration, firewall configuration or other considerations.

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

#!/bin/sh
# Offsite Backup script
# Written by www.stardothosting.com
# Dynamic backup script

currentmonth=`date "+%Y-%m-%d %H:%M:%S"`
currentdate=`date "+%Y-%m-%d%H_%M_%S"`
backup_email="backups@youremail.com"
backupserver="origin-backup-server.hostname.com"

# Check User Input
if [ "$  #" -lt 2 ]
then
        echo -e "nnUsage Syntax :"
        echo -e "./backup.sh [hostname] [folder1] [folder2] [folder3]"
        echo -e "Example : ./backup.sh your-server.com '/etc' '/usr/local/www' '/var/lib/mysql'nn"
        exit 1
fi

# get the server's hostname
host_name=`ssh -l root $  1 "hostname"`
echo "Host name : $  host_name"
if [ "$  host_name" == "" ]
then
        host_name="unknown_$  currentdate"
fi

echo "$  host_name Offsite Backup Report: " $  currentmonth > /var/log/backup.log
echo -e "----------------------------------------------------------" >> /var/log/backup.log
echo -e "" >> /var/log/backup.log

# Ensure permissions are correct
chown -R backups:backups /home/fileserver/backups/
ls -d /home/fileserver/backups/* | grep -v ".ssh|.bash" | xargs -d "n" chmod -R 775

# iterate over user arguments & set error level to 0
errors=0
for arg in "$  {@:2}"
do
        # check if receiving directory exists
        if [ ! -d "/home/fileserver/backups/$  host_name" ]
        then
                mkdir /home/fileserver/backups/$  host_name
        fi
        sanitize=`echo $  arg | sed 's/[^/]/+$   //'`
        sanitize_dir=`echo $  arg | awk -F '/' '{printf "%s", $  2}'`
        /usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir; echo $  ? > /tmp/bu_rlevel.txt" >> /var/log/backup.log 2>&1
        echo "/usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir""

        runlevel=`ssh -l root $  1 "cat /tmp/bu_rlevel.txt"`
        echo "Runlevel : $  runlevel"

        if [ "$  runlevel" -ge 1 ]
        then
                errors=$  ((counter+1))
        else
                echo -e "Script Backup for $  arg Completed Successfully!" >> /var/log/backup.log 2>&1
        fi

done


# Check error level
if [ $  errors -ge 1 ]
then
        echo -e "There were some errors in the backup job for $  host_name, please investigate" >> /var/log/backup.log 2>&1
        cat /var/log/backup.log | mail -s "$  host_name Backup Job failed" $  backup_email
else
        cat /var/log/backup.log | mail -s "$  host_name Backup Job Completed" $  backup_email
fi

It should be explained further that this script actually connects to the destination server as the root user, using ssh key authentication. It then initiates a remote rsync command on the destination server back to the backup server as a user called “backupuser”. So that means that not only does the ssh key need to be installed for root on the destination servers, but a user called “backupuser” needs to be added on the backup server itself, with the ssh keys of all the destination servers installed for the remote rsync.

Hopefully I did not over complicate this, because it really is quite simple :

Backup Server –> root –> destination server to backup — > backupuser rsync –> Backup Server

Once you implement the script and do a few dry run tests then it might be ready to implement a scheduled task for each destination server. Here is an example of one cron entry for a server to be backed up :

01 1 * * * /bin/sh /usr/local/bin/backups.sh destination-server-hostname '/etc' '/usr/local/www' '/home/automysql-backups'

The post Centralized Backup Script appeared first on Managed WordPress Hosting | Managed VPS Hosting | Stack Star.

Managed WordPress Hosting | Managed VPS Hosting | Stack Star

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Filed Under: Web Hosting Tagged With: backup, Centralized, script

Centralized Backup Script

October 24, 2019 by Admin Leave a Comment

Hello There!

I thought I’d share a backup script that was written to consolidate backups onto one server instead of spreading the backup process across several servers. The advantages are somewhat obvious to consolidating the script onto one server, namely being that editing or making changes is much easier as you only have one script to edit.

The environment where this may be ideal would be for environments with 15-20 servers or less. I’d recommend a complete end-to-end backup solution for servers that exceed that number such as Bacula perhaps.

The bash shell script that I pasted below is very straightforward and takes two arguments. The first is the hostname or ip address of the destination server you are backing up. The next (and potentially unlimited) arguments will be single quote encased folders which you would want backed up.

This script is dependent on the server the script is running on having ssh key based authentication enabled and implemented for the root user. Security considerations can be made with IP based restrictions either in the ssh configuration, firewall configuration or other considerations.

#!/bin/sh
# Offsite Backup script
# Written by www.stardothosting.com
# Dynamic backup script

currentmonth=`date "+%Y-%m-%d %H:%M:%S"`
currentdate=`date "+%Y-%m-%d%H_%M_%S"`
backup_email="backups@youremail.com"
backupserver="origin-backup-server.hostname.com"

# Check User Input
if [ "$  #" -lt 2 ]
then
        echo -e "nnUsage Syntax :"
        echo -e "./backup.sh [hostname] [folder1] [folder2] [folder3]"
        echo -e "Example : ./backup.sh your-server.com '/etc' '/usr/local/www' '/var/lib/mysql'nn"
        exit 1
fi

# get the server's hostname
host_name=`ssh -l root $  1 "hostname"`
echo "Host name : $  host_name"
if [ "$  host_name" == "" ]
then
        host_name="unknown_$  currentdate"
fi

echo "$  host_name Offsite Backup Report: " $  currentmonth > /var/log/backup.log
echo -e "----------------------------------------------------------" >> /var/log/backup.log
echo -e "" >> /var/log/backup.log

# Ensure permissions are correct
chown -R backups:backups /home/fileserver/backups/
ls -d /home/fileserver/backups/* | grep -v ".ssh|.bash" | xargs -d "n" chmod -R 775

# iterate over user arguments & set error level to 0
errors=0
for arg in "$  {@:2}"
do
        # check if receiving directory exists
        if [ ! -d "/home/fileserver/backups/$  host_name" ]
        then
                mkdir /home/fileserver/backups/$  host_name
        fi
        sanitize=`echo $  arg | sed 's/[^/]/+$   //'`
        sanitize_dir=`echo $  arg | awk -F '/' '{printf "%s", $  2}'`
        /usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir; echo $  ? > /tmp/bu_rlevel.txt" >> /var/log/backup.log 2>&1
        echo "/usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir""

        runlevel=`ssh -l root $  1 "cat /tmp/bu_rlevel.txt"`
        echo "Runlevel : $  runlevel"

        if [ "$  runlevel" -ge 1 ]
        then
                errors=$  ((counter+1))
        else
                echo -e "Script Backup for $  arg Completed Successfully!" >> /var/log/backup.log 2>&1
        fi

done


# Check error level
if [ $  errors -ge 1 ]
then
        echo -e "There were some errors in the backup job for $  host_name, please investigate" >> /var/log/backup.log 2>&1
        cat /var/log/backup.log | mail -s "$  host_name Backup Job failed" $  backup_email
else
        cat /var/log/backup.log | mail -s "$  host_name Backup Job Completed" $  backup_email
fi

It should be explained further that this script actually connects to the destination server as the root user, using ssh key authentication. It then initiates a remote rsync command on the destination server back to the backup server as a user called “backupuser”. So that means that not only does the ssh key need to be installed for root on the destination servers, but a user called “backupuser” needs to be added on the backup server itself, with the ssh keys of all the destination servers installed for the remote rsync.

Hopefully I did not over complicate this, because it really is quite simple :

Backup Server –> root –> destination server to backup — > backupuser rsync –> Backup Server

Once you implement the script and do a few dry run tests then it might be ready to implement a scheduled task for each destination server. Here is an example of one cron entry for a server to be backed up :

01 1 * * * /bin/sh /usr/local/bin/backups.sh destination-server-hostname '/etc' '/usr/local/www' '/home/automysql-backups'

The post Centralized Backup Script appeared first on Managed WordPress Hosting | Managed VPS Hosting | Stack Star.

Managed WordPress Hosting | Managed VPS Hosting | Stack Star

Filed Under: Web Hosting Tagged With: backup, Centralized, script

ElephantDrive – Your Online Backup Solution

February 28, 2019 by Admin Leave a Comment

ElephantDrive Plans

  • Personal Plan – $ 9.95/mo. ($ 99.50/yr); Ideal for personal home use. Includes 100GB of storage, accessible by 2 different computers, and some advanced features.
  • Family Plan – $ 19.95/mo. ($ 199.50/yr); Ideal for today’s Internet connected family. Includes 500GB of storage, accessible by 5 different computers, and advanced features.
  • Enterprise Plan – price varies depending on storage. With any of our Enterprise Plans you get ElephantDrive’s most advanced features, including: Large and open file backup. Multiple user set-up with distinct login credentials. Support for unlimited devices. Support for network drives and servers. Unlimited versions of every file saved to the cloud.


ElephantDrive Online Storage
Elephant Drive Features:

  • Secure 128-bit SSL transfers/256-bit AES encryption
  • Universal access, anywhere, any time
  • TrunkDrive, mount as a disk drive for drag-and-drop backup
  • Fast and reliable servers

Web Hosting Comparison

Filed Under: Web Hosting Comparison Tagged With: backup, ElephantDrive, online, Solution

Centralized Backup Script

February 23, 2017 by Admin Leave a Comment

Hello There!

I thought I’d share a backup script that was written to consolidate backups onto one server instead of spreading the backup process across several servers. The advantages are somewhat obvious to consolidating the script onto one server, namely being that editing or making changes is much easier as you only have one script to edit.

The environment where this may be ideal would be for environments with 15-20 servers or less. I’d recommend a complete end-to-end backup solution for servers that exceed that number such as Bacula perhaps.

The bash shell script that I pasted below is very straightforward and takes two arguments. The first is the hostname or ip address of the destination server you are backing up. The next (and potentially unlimited) arguments will be single quote encased folders which you would want backed up.

This script is dependent on the server the script is running on having ssh key based authentication enabled and implemented for the root user. Security considerations can be made with IP based restrictions either in the ssh configuration, firewall configuration or other considerations.

#!/bin/sh
# Offsite Backup script
# Written by www.stardothosting.com
# Dynamic backup script

currentmonth=`date "+%Y-%m-%d %H:%M:%S"`
currentdate=`date "+%Y-%m-%d%H_%M_%S"`
backup_email="backups@youremail.com"
backupserver="origin-backup-server.hostname.com"

# Check User Input
if [ "$  #" -lt 2 ]
then
        echo -e "nnUsage Syntax :"
        echo -e "./backup.sh [hostname] [folder1] [folder2] [folder3]"
        echo -e "Example : ./backup.sh your-server.com '/etc' '/usr/local/www' '/var/lib/mysql'nn"
        exit 1
fi

# get the server's hostname
host_name=`ssh -l root $  1 "hostname"`
echo "Host name : $  host_name"
if [ "$  host_name" == "" ]
then
        host_name="unknown_$  currentdate"
fi

echo "$  host_name Offsite Backup Report: " $  currentmonth > /var/log/backup.log
echo -e "----------------------------------------------------------" >> /var/log/backup.log
echo -e "" >> /var/log/backup.log

# Ensure permissions are correct
chown -R backups:backups /home/fileserver/backups/
ls -d /home/fileserver/backups/* | grep -v ".ssh|.bash" | xargs -d "n" chmod -R 775

# iterate over user arguments & set error level to 0
errors=0
for arg in "$  {@:2}"
do
        # check if receiving directory exists
        if [ ! -d "/home/fileserver/backups/$  host_name" ]
        then
                mkdir /home/fileserver/backups/$  host_name
        fi
        sanitize=`echo $  arg | sed 's/[^/]/+$   //'`
        sanitize_dir=`echo $  arg | awk -F '/' '{printf "%s", $  2}'`
        /usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir; echo $  ? > /tmp/bu_rlevel.txt" >> /var/log/backup.log 2>&1
        echo "/usr/bin/ssh -o ServerAliveInterval=1 -o TCPKeepAlive=yes -l root $  1 "/usr/bin/rsync -ravzp --progress --exclude 'clam_quarantinedir' $  sanitize/ backups@$  backupserver:/home/fileserver/backups/$  host_name/$  sanitize_dir""

        runlevel=`ssh -l root $  1 "cat /tmp/bu_rlevel.txt"`
        echo "Runlevel : $  runlevel"

        if [ "$  runlevel" -ge 1 ]
        then
                errors=$  ((counter+1))
        else
                echo -e "Script Backup for $  arg Completed Successfully!" >> /var/log/backup.log 2>&1
        fi

done


# Check error level
if [ $  errors -ge 1 ]
then
        echo -e "There were some errors in the backup job for $  host_name, please investigate" >> /var/log/backup.log 2>&1
        cat /var/log/backup.log | mail -s "$  host_name Backup Job failed" $  backup_email
else
        cat /var/log/backup.log | mail -s "$  host_name Backup Job Completed" $  backup_email
fi

It should be explained further that this script actually connects to the destination server as the root user, using ssh key authentication. It then initiates a remote rsync command on the destination server back to the backup server as a user called “backupuser”. So that means that not only does the ssh key need to be installed for root on the destination servers, but a user called “backupuser” needs to be added on the backup server itself, with the ssh keys of all the destination servers installed for the remote rsync.

Hopefully I did not over complicate this, because it really is quite simple :

Backup Server –> root –> destination server to backup — > backupuser rsync –> Backup Server

Once you implement the script and do a few dry run tests then it might be ready to implement a scheduled task for each destination server. Here is an example of one cron entry for a server to be backed up :

01 1 * * * /bin/sh /usr/local/bin/backups.sh destination-server-hostname '/etc' '/usr/local/www' '/home/automysql-backups'

The post Centralized Backup Script appeared first on Managed WordPress Hosting | Managed VPS Hosting | Stack Star.

Managed WordPress Hosting | Managed VPS Hosting | Stack Star

Filed Under: Web Hosting Tagged With: backup, Centralized, script

Key Elements when Looking for a Cloud Backup Services

February 16, 2017 by Admin Leave a Comment

Imagine what would happen if all your company’s data suddenly disappeared: your website, software, business documents, emails, contacts, subscriber lists, employee records, customer credit card details, everything. This does happen. It can be caused by fire, flood, theft, human error, hacking, machine failure and various other things. Without a backup, the loss of this data …

Web Hosting UK Blog

Filed Under: VPS / Dedicated Servers Tagged With: backup, Cloud, Elements, Looking, Services

Website Backup Provider CodeGuard Releases cPanel, WHMCS Plugins

February 24, 2015 by Admin Leave a Comment

Cloud-based website backup provider CodeGuard has released cPanel and WHMCS plugins to enable hosting providers to offer its service. CodeGuard is initially integrating with enterprise-class hosting provider A Small Orange.

The post Website Backup Provider CodeGuard Releases cPanel, WHMCS Plugins appeared first on Web Hosting Talk.

Web Hosting Talk

Filed Under: Web Hosting News Tagged With: backup, CodeGuard, cPanel, Plugins, Provider, Releases, Website, WHMCS

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 11
  • Go to Next Page »

Primary Sidebar

Made with love by Hosting-New