我有一个脚本:
-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.
答案 0 :(得分:0)
bconsole还没有在PATH中,所以我使用了bconsole命令的完整路径,如下所示:
体积= echo "list volumes" | /sbin/bconsole|grep -i "Append\|Full"|awk '{print $4}'
echo“purge volume = $ volume yes”| / sbin目录/ bconsole