zoukankan      html  css  js  c++  java
  • crontab定时任务

    定时任务没有运行,查看cron运行日志
    tail -f /var/log/cron
    报如下错误:
    May 8 10:14:01 localhost crond[9399]: (root) FAILED to authorize user with PAM (Module is unknown)
    May 8 10:14:01 localhost crond[9400]: (root) FAILED to authorize user with PAM (Module is unknown)

    解决办法:
    1、禁用SELinux,可以使用getenforce命令查看是否禁用。

    2、查看用户密码是否过期chage -l root,修改为永不过期(命令:chage -M 9999 root,文件:vi /etc/shadow)

    2、修改/etc/cron.allow,添加要运行定时任务的用户
    root
    myuser

    3、修改/etc/pam.d/crond,把session required改成session sufficient,这个对非root用户管用,root用户不需要修改该文件

    #
    # The PAM configuration file for the cron daemon
    #
    #
    # No PAM authentication called, auth modules not needed
    account    required pam_access.so
    account    include    password-auth
    # session    required pam_loginuid.so
    session    sufficient pam_loginuid.so
    session    include    password-auth
    auth       include    password-auth

    4、重启crond服务
    /etc/init.d/crond restart

    参考链接:
          https://www.generateit.net/cron-job/index.php      #在线生成定时任务
          https://www.cnblogs.com/zoulongbin/p/6187238.html
          http://www.tracefact.net/tech/080.html
          https://www.cnblogs.com/fuhai0815/p/14338928.html
          https://opensource4admin.wordpress.com/2014/07/31/failed-to-authorize-user-with-pam-module-is-unknown-solved/

  • 相关阅读:
    5555
    3333
    4444
    试验2
    Android之TextView灵活使用(转载)
    Android之使用Android-query框架进行开发(一)(转载)
    Android 之Html的解析(使用jsoup)
    Android之动画的学习(转载)
    Android之官方下拉刷新控件SwipeRefreshLayout
    Android之sqlite的使用 (转载)
  • 原文地址:https://www.cnblogs.com/xwupiaomiao/p/14967329.html
Copyright © 2011-2022 走看看