僕の備忘録(PC、UN*X、ネットワーク関連が中心)なんです。
自分の書いたところは適当(な時とか)に書き換えますので御了承を。
centos7なかなか慣れず、試行錯誤。
タイトルの組み合わせが、なぜかうまく機能しなかった。
適当に検索して、パスワード指定忘れと
/etc/sudoersの一行を塞いでようやく。
$ cat /etc/pam.d/crond # # 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 include password-auth auth include password-auth
$ sudo visudo # Defaults specification # # Disable "ssh hostname sudo", because it will # show the password in clear. # You have to run "ssh -t hostname sudo ". # #Defaults requiretty
$ sudo vi /etc/crontab # * * * * * user-name command to be executed */5 * * * * a_user sudo -u root lynx http://localhost -dump >$HOME/hoge.txt */4 * * * * root sudo -u a_user lynx http://localhost -dump >$HOME/fuga.txt
リンクはご自由にどうぞ。でもURLや内容が変った場合はあしからず。