我想在cPanel / linux服务器上创建一个脚本。 我希望它检查所有可能的错误。
#/bin/bash
cpanel_username=$1
domain=$2
if [ -z "$cpanel_username" ]
then
echo "no username given"
elif [ -z "$domain" ]
then
echo "no domain given"
else
/scripts/pkgacct $cpanel_username /backup/
mv /backup/cpmove-$cpanel_username.tar.gz /backup/$cpanel_username.tar.gz
FILE="/backup/$cpanel_username.tar.gz"
FTPFILE="$cpanel_username.tar.gz"
if [ -f "$FILE" ]
then
### FTP login credentials bellow ###
FTPU="ftpuser"
FTPP="ftpass"
FTPS="host"
lftp -u $FTPU,$FTPP -e "cd /hosting_backups;put $FILE;quit" $FTPS
######HERE I WANT TO CHECK IF THE FILE IS UPLOADED
rm /backup/$cpanel_username.tar.gz
else
echo "couldnt take backup of $domain"
fi
fi
另外我想知道我是否可以检查是否有足够的空间供我备份。我希望在备份命令之前完成此操作。
我已经尝试了很多个小时,但我无法做到。任何帮助表示赞赏