/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'/bin/sh: -c: line 1: Syntax error: unexpected end of file
奇怪的是,它在提示符下执行时效果很好
全剧本
#!/bin/shNow=$(date +"%b-%d-%y")bu_PATH="/home/webserver/"curtime=$(date)echo ""echo "Starting backup: $curtime"echo ""echo "Moving to $bu_PATH"cd $bu_PATHBACKUP_file="backup_$Now.tgz"echo ""echo "The backup file will be called $BACKUP_file"RUN_BACKUP="/usr/local/psa/bin/pleskbackup --server --output-file=$bu_PATH$BACKUP_file"echo "Running backup...."echo `$RUN_BACKUP`curtime=$(date)echo "Backup complete: $curtime"echo ""echo "Remove older than 7 days of files..."ssh server '/shares/backup/webserver/cleanup.sh'curtime=$(date)echo ""echo "Connecting to FTP: $curtime"sftp -b server <<EOF cd /shares/backup/webserver/ put $bu_PATH$BACKUP_file quitEOF;curtime=$(date)echo "FTP Transfer Complete: $curtime"echo ""echo "Cleaning up Local backups"sh /home/cleanup.shecho ""echo "Clean up log files"find /home/webserver/logs/*.log -mtime +7 -exec rm {} \;echo "Job Complete"
这是crontab条目
/home/backup.sh > /home/webserver/logs/BackupLog-`date +%m%d%y`.log
谢谢
抢
像这样:
/home/backup.sh > /home/webserver/logs/BackupLog-`date +\%m\%d\%y`.log
如果你不逃避它们,它们将被视为换行符.
总结以上是内存溢出为你收集整理的linux – Bash脚本的工作原理是提示,但不是来自cron全部内容,希望文章能够帮你解决linux – Bash脚本的工作原理是提示,但不是来自cron所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)