-1
我有一个脚本:脚本不运行
-rwx------. 1 root root 135 Oct 15 12:00 /backup/purge.sh
#!/bin/bash
volume=`echo "list volumes" | bconsole|grep -i "Append\|Full"|awk '{print $4}'`
echo "purge volume=$volume yes" | bconsole
如果我手动运行它,它运行。
如果我把脚本放到crontab中,它不会运行,但是日志说它运行了。
Oct 15 16:07:01 sdfdsfdsf CROND[36326]: (root) CMD (/backup/purge.sh)
时间表:
07 16 * * * /backup/purge.sh
如果我手动运行:
/backup/purge.sh
Connecting to Director weewr:9101
1000 OK: 1 werewrewrewr Version: 7.0.5 (28 July 2014)
Enter a period to cancel a command.
purge volume=Vol-0001 yes
This command can be DANGEROUS!!!
It purges (deletes) all Files from a Job,
JobId, Client or Volume; or it purges (deletes)
all Jobs from a Client or Volume without regard
to retention periods. Normally you should use the
PRUNE command, which respects retention periods.
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
1 File on Volume "Vol-0001" purged from catalog.
There are no more Jobs associated with Volume "Vol-0001". Marking it purged.
可能是OT,但要确保'bconsole'在路径中,或者在脚本中提供完整路径。由于cron作业不能以交互方式运行,因此可以设置不同的路径。也可以在crontab中设置PATH。 – Doon
已解决,脚本中需要的完整路径。 – Badb0y
@ Badb0y自解决问题之后就为解决方案添加答案。 – AJefferiss