Crontab 定時任務
阿新 • • 發佈:2020-07-30
新接管一些公司資料庫,每天都能看到備份
檢視備份指令碼:(所有使用者的定時任務)
cat /etc/passwd | cut -f 1 -d : |xargs -I {} crontab -l -u {}
發現定時任務存在於 Oracle 使用者中
進入使用者,crontab -l
You (ddt) are not allowed to use this program (crontab)
See crontab(1) for more information
看來是做了限制,Oracle使用者被限制使用了crontab指令
檢視限制(這兩個檔案可能有可能沒有)
/etc/cron.deny # 該檔案中所列使用者不允許使用crontab命令
加入Oracle 使用者(因環境不熟,佔時未變化)
# echo oracle > /etc/cron.allow
使用root使用者檢視
crontab -l -u oracle
# crontab -e -u oracle (編輯oracle使用者的定時任務)
#0 19 * * * sh /home/oracle/backup/scripts/rman_XX.sh
#20 20 * * * sh /home/oracle/backup/scripts/rman_XXX.sh
#40 1 * * * sh /home/oracle/backup/scripts/rman_XXXX.sh