Crontab 定时任务

新接管一些公司数据库,每天都能看到备份

查看备份脚本:(所有用户的定时任务)

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命令
/etc/cron.allow    # 该文件中所列用户允许使用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

原文地址:https://www.cnblogs.com/Leo-Cjh/p/13403833.html