PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : Cpanel remote FTP backup script



Vahid
August 6th, 2008, 01:53
Michal LaSalvia of EZHOSTINGPRO has created a script for remote cpanel backups. It is a basic shell script that will allow the server owner to charge for remote backups. Basically those users that pay for a remote backup service will be added to the flat file by the server admin and have a backup script put in there home directory. The only thing that is not automated is the process of adding the new user to the database and placing the placing the backup script into the users home directory.

Michal currently has the customers fill out a form and upon submission of the payment he will create a remote ftp account and add the customers account to the backup.

Script 1:

#!/bin/bash

############################################
## ##
## EZHOSTINGPRO BACKUP FTP SCRIPT v1.0 ##
## Created by Michael LaSalvia ##
## http://www.ezhostingpro.com/backup.php (http://www.ezhostingpro.com/backup.php) ##
## 2/23/04 rev 1 ##
############################################
## 1. Create a file called cpbackup.txt in /root
## 2. Place account names you wanted backup
## 3. Save file in /root
############ DO NOT EDIT BELOW #############
cd /root
for users in $(cat cpbackup.txt)
do
rm -rf /home/$users/cpmove-$users.tar.gz
/scripts/pkgacct $users
mv /home/cpmove-$users.tar.gz /home/$users/
cd /home/$users
chown $users.$users cpmove-$users.tar.gz
chmod 777 cpmove-$users.tar.gz
/home/$users/bkftp.sh
cd /root
done

- This script must be ran as root user to be able to call the cpanel pkgacct.

Script 2: This script will be edited with the users ftp credentials and placd in the user home dir.

#!/bin/bash

##################################
## EZHOSTINGPRO REMOTE BACKUP ##
## created by: Michael LaSalvia ##
## (c)EZHOSTINGPRO 2004 ##
## DO NOT EDIT THIS FILE ##
## Name this file bkftp.sh chmod 777 ##
##################################



### VARIABLES ###

var_cpaneluser='cpanel_user_goes_here'
#var_targetdir='public_html' /* implemented in vs2.0 still in testing
var_remote='remote_server_goes_here'
var_ftpuser='remote_server_ftp_username_goes_here'
var_ftppass='remote_server_ftp_password_goes_here'

cd /home/$var_cpaneluser
ftp -n $var_remote <<END_SCRIPT
quote USER $var_ftpuser
quote PASS $var_ftppass
del cpmove-$var_cpaneluser.tar.gz
put cpmove-$var_cpaneluser.tar.gz
quit
END_SCRIPT
exit 0
rm -Rf cpmove-$var_cpaneluser.tar.gz


Here are some additional comments by Michal:

Test it out if you get any errors or issues contact me and I will correct it. This script is still in the works but this is a working model of it. Next version will have a payment system that will add the users to the db and auto place the files in the correct directories.

This code is not to be changed or sold - it is is released under the left hand gpl.

Please contact Michal for questions or concerns.