Welcome the year-end holidays, HostUS taken various promotions including 2 OpenVZ VPS package super cheap prices KVM VPS and VPS STORAGE.
Parameter 2 VPS promotional package this session as follows:
$ 25/per year
Package VPS 2GB This is too good for dich vu seo web, the price is only $ 25 when paid in years, counted out just $ 2.08 / month only. Also pack KVM VPS STORAGE RAM at 256MB web server should not do, however, high-capacity 180GB Disk Space (RAID 10) can do server storage, backup.
In addition, this phase HostUS discount coupon also launched a range of services on site, press the corresponding button to copy code:
8ATPBD47L2 – Shared Hosting 30% discount when paying by year
SDSFI4V78Y – 20% discount Reseller Hosting
M2YSVHK9W2 – 25% Off & KVM VPS OpenVZ packages
GN47EO8JD6 – Comodo PositiveSSL cost only $ 4.99 / year
Deals stretching from now until 01/03/2017 or end slot when registering. The entire coupon, promotion is only for new subscribers only.
If you need to register Hong Kong or Singapore location, refer to article.
Yesterday I had to share a script to help automatically backup the entire WordPress website activity on the server settings HocVPS Script . However, today I will introduce a better bash scripts, the entire VPS backup with instructions to create autorun daily cronjob always.
This script automatically back up all data on the server, including:
public_htmlof the domain, in the form
All data will be compressed into a .zip file to the directory and
/ root / backup / and automatically delete old backup files, only keeping the file within 14 days of return.
Thus, you absolutely can use this script to move the VPS, or restore any particular piece of data. Her script writing is compatible with the directory structure by HocVPS Script management, but you can also modify to fit any other server also.
Currently, I am using this script to daily data backup and upload to Google Drive with Rclone.
– Creates backup.sh file in the directory / root /
Consult guidelines use nano if unknown user.
– Copy the entire contents of the script below and paste into:
# HocVPS Plugin Script - Backup Server #! / Bin / bash . /etc/hocvps/scripts.conf SERVER_NAME = VPS TIMESTAMP = $ (date + "% Y-% m-% H% M D_%") BACKUP_DIR = "/ root / backup / $ TIMESTAMP" MYSQL_USER = "root" MYSQL = / usr / bin / mysql MYSQL_PASSWORD = $ mariadbpass Mysqldump = / usr / bin / mysqldump SECONDS = 0 mkdir -p "$ BACKUP_DIR / mysql" echo "Starting Backup Database"; = `$ MYSQL databases --user = $ MYSQL_USER -p -e $ MYSQL_PASSWORD" SHOW databases; " | -Ev grep "(Database | information_schema | performance_schema | mysql)" ` print for $ db databases; dirty $ Mysqldump --user = $ MYSQL_USER --opt --force -p $ MYSQL_PASSWORD --databases $ db | gzip> "$ BACKUP_DIR / mysql / $ db.gz" done echo "Finished"; echo ''; echo "Starting Backup Website"; #Loop Through the / home directory for D in / home / *; dirty if [ -d "$D" ]; then #if a directory domain = $ D ## * / # Domain name echo "-" $ domain; zip -r $ BACKUP_DIR / $ domain.zip / home / $ domain / public_html / q -x / home / $ domain / public_html / wp-content / cache / ** * #Exclude cache fi done echo "Finished"; echo ''; echo "Starting Backup Nginx Configuration"; cp -r $ /etc/nginx/conf.d/ BACKUP_DIR / nginx / echo "Finished"; echo ''; echo "Starting Compress Files"; zip -r -q /root/backup/$SERVER_NAME-$TIMESTAMP.zip $ BACKUP_DIR rm -rf $ BACKUP_DIR size = $ (ls -lah /root/backup/$SERVER_NAME-$TIMESTAMP.zip | awk 'print $ 5') echo "Finished"; echo ''; #remove Older backups (14 days) find / root / backup / -mindepth 1 -mtime +14 -delete duration = $ SECONDS echo "Total $ size, $ (($ duration / 60)) minutes and $ (($ duration% 60)) seconds elapsed."
– Press Ctrl + O, Enter to save and Ctrl + X to exit.
– Distribution rights to the script
chmod + x /root/backup.sh
– So that’s it then, now you can test it by running the command
Done, check the folder
/ root / backup / has yet lightweight .ZIP file backup.
Now I would for scripts automatically run at 2:00 am.
crontab -e EDITOR = nano
Paste the following into the Terminal window
0 2 * * * /root/backup.sh> / dev / null 2> & 1
Press Ctrl + O, Enter to save and Ctrl + X to exit
That’s it, keep daily 2am script automatically runs, the entire data backup of VPS.
In the next article, I will guide you how to automatically upload files to Google Drive backups to save space for VPS. Me welcome to read offline.