You are not logged in.
So I'm attempting to shutdown my pc with cronie, however cron lacks the permissions to shutdown the machine. Cron calls "/usr/bin/systemctl poweroff" which broadcasts "The system is going down for power-off NOW!" and nothing happens. It works fine invoked from the terminal or root's crontab. I suspect it has something to do with PAM permissions.
Any help would be greatly appreciated.
crontab -e
18 19 * * * /usr/bin/systemctl poweroffjournalctl -u cronie
-- Logs begin at Fri 2013-03-08 19:14:22 NZDT, end at Fri 2013-03-08 19:18:19 NZDT. --
Mar 08 19:14:23 archpc crond[298]: (CRON) INFO (Syslog will be used instead of sendmail.)
Mar 08 19:14:23 archpc crond[298]: (CRON) INFO (running with inotify support)
Mar 08 19:18:01 archpc crond[298]: (user) RELOAD (/var/spool/cron/user)
Mar 08 19:18:01 archpc crond[899]: pam_unix(crond:session): session opened for user user by (uid=0)
Mar 08 19:18:01 archpc CROND[900]: (user) CMD (/usr/bin/systemctl poweroff)
Mar 08 19:18:01 archpc CROND[899]: (user) CMDOUT (Failed to issue method call: Access denied)
Mar 08 19:18:01 archpc CROND[899]: (user) CMDOUT (Failed to issue method call: Access denied)
Mar 08 19:18:01 archpc CROND[899]: pam_unix(crond:session): session closed for user user/etc/pam.d/crond
auth required pam_unix.so
auth required pam_env.so
account required pam_access.so
account required pam_unix.so
account required pam_time.so
session required pam_loginuid.so
session required pam_limits.so
session required pam_unix.soOffline
Try & do under root.
sudo bash
crontab -eLife is pleasant. Death is peaceful. It's the transition that's troublesome. Isaac Asimov - / -
Offline
Thanks for the reply. It works as you suggested. However, my user has permission to poweroff the machine so I shouldn't need to use root crontab.
Offline
Thanks for the reply. It works as you suggested. However, my user has permission to poweroff the machine so I shouldn't need to use root crontab.
But cron knows nothing about your user. I use something like:
SHELL=/bin/zsh
15 0-23/4 * * * . /home/antoine/.zprofile && imac_bakwhich brings in my environment before it executes the next file.
Also, at the risk of sounding stupid, those systemctl commands have to be run in the same "session" that the user is logged in on, I believe; I don't know if cron doesn't log in on a different session.
Offline