我在 rdiff-backup 自动化方面遇到了麻烦。目前有 2 个问题。
脚本本身:
#!/bin/bash
# This is backup script for rdiff-backup
# Backup command
rdiff-backup --include-globbing-filelist /home/administrator/backup.list / /mnt/backup/dst
#Checking rdiff-backup command success / error
status=$?
if [ $status != 0 ]; then
# Append error message in ~/backup.log file
echo "rdiff-backup exit Code: $status - Command Unsuccessful">>~/varundus.log;
exit 1;
fi
# Remove incremental backup files older than two weeks
rdiff-backup --force --remove-older-than 1W /mnt/backup/dst/
第一个问题是,终端在执行时出现错误:
rdiff-backup --force --include-globbing-filelist backup.list / /mnt/backup/dst/
错误:
Found interrupted initial backup. Removing...
Fatal Error: Last selection expression:
Command-line include glob: /var/www
only specifies that files be included. Because the default is to
include all files, the expression is redundant. Exiting because this
probably isn't what you meant.
是什么原因造成的?
第二个错误是,如果我运行我的脚本,我会得到:
./inc-backup.sh: line 5: rdiff-backup: command not found
./inc-backup.sh: line 9: syntax error near unexpected token `then'
./inc-backup.sh: line 9: `if [ $status != 0 ]; then'
为什么那个 shell 找不到命令,但是如果我手动输入它,它就可以工作(但第一部分有错误)。有人能解释一下我做错了什么吗?谢谢 :)