更新时间:2024-06-13 GMT+08:00
分享

crontab -l \n+ echo 'Permission denied crontab'

问题现象

SLB部署失败,日志详细信息提示如下:

"the_perfix=/opt/huawei/openresty\n+ crontab -l \n+ echo 'Permission denied crontab' \n+ exit 1"

解决方法

  1. 定时任务的权限问题。

    登录SLB实例主机执行如下命令:

    su 业务用户
    crontab -e

    如果提示:“You (业务用户) are not allowed to use this program (crontab)”,说明该业务用户没有定时任务权限,进行如下命令添加业务用户后保存,一个用户一行:

    vi /etc/cron.allow
    图1 查看权限
  2. 定时任务的具体配置。
    su 业务用户
    crontab -e 

    如果内容为空,则复制以下内容,彻底解决这个问题。

    59 23 * * * /opt/huawei/openresty/bin/logratate.sh >>/dev/null 2>&1
    */1 * * * * source ~/.profile && bash -lc "/opt/huawei/easyconf/bin/confagent_monitor check" > /dev/null 2>&1
    * * * * * /opt/huawei/openresty/watch-dog/bin/watchdog.sh mon>>/dev/null 2>&1
    • 每行开头的* * * * *对应的是分 时 日 月 周,“59 23 * * *” 表示每天23点59分,“*/1 * * * * ”表示每分钟一次。
    • logratate.sh 为日志切割脚本。
分享:

SLB部署失败相关问题 所有常见问题

more