设为首页收藏本站

BC Morning Updates

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 434|回复: 1

Bash Script for external backup

[复制链接]
发表于 2015-3-16 10:12:36 | 显示全部楼层 |阅读模式
本帖最后由 Test 于 2015-3-16 10:14 编辑

the "/scripts/pkgacct" cPanel script to backup the cPanel account and then use the SCP command to transfer the file to the backup server.

http://www.ss64.com/bash/scp.html

Then to automate it, just create a cron job for it.

cPanel's backup system will do the exact same thing and transfer it to a remote server if you configure it to do so.

  1. #!/bin/bash

  2. rsync -avzr -e "ssh -p SSHPORT /backup/cpbackups/ user@remoteserver.name.com:/path/on/remote/server/"
复制代码


This is of course if you're using the old backup system.  The latest cpanel update has all of this built in.  However, you can run the above on a cron if you'd like.  Or better yet, throw it in as a postcpbackup hook and it will automatically run every time the backup completes.

Of course you don't want your backup server filling up.  So on the backup server, you can use a second cron using the find command to delete all files older than X days.
 楼主| 发表于 2015-3-16 10:17:11 | 显示全部楼层
本帖最后由 Test 于 2015-3-16 10:18 编辑

I tried solutions without bash.In command line via ssh,
  1. tar czf backup.tar.gz `ls /www/hosting | grep \.com$ | sed 's/$/\/www/g' | sed 's/^/\/www\/hosting\//g'`
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2019-9-18 04:15 , Processed in 0.074179 second(s), 19 queries .

Supported by Bestdeal Online

© 2008-2019 BestDeal Online Inc.

快速回复 返回顶部 返回列表