-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.
4

1 に答える 1

0

bconsole は PATH に含まれていないため、次のように bconsole コマンドのフル パスを使用しました。

!/ビン/バッシュ

volume= echo "list volumes" | /sbin/bconsole|grep -i "Append\|Full"|awk '{print $4}' echo "purge volume=$volume はい" | /sbin/bconsole

于 2015-10-15T20:51:47.827 に答える