[systemd-devel] From command-line 'systemctl suspend' works' from cron it does not
Kai Krakow
hurikhan77 at gmail.com
Wed Mar 23 00:32:09 UTC 2016
Am Mon, 21 Mar 2016 09:21:39 +0100
schrieb Cecil Westerhof <cldwesterhof at gmail.com>:
> When executing
> systemctl suspend || echo "Error code: ${?}"
> from the command-line it outputs
> Error code: 1
> and it puts my machine in suspend.
>
> When putting it in cron it gives the following errors:
> Failed to execute operation: Access denied
> Failed to start suspend.target: Access denied
> and gives the output:
> Error code: 4
>
> What is happening here? Is it possible to run 'systemctl suspend' from
> cron, or is there a reason why this is not possible?
It's probably because cron doesn't setup a systemd session. Do you
eventually run from a user crontab? Have you tried running from a root
crontab?
--
Regards,
Kai
Replies to list-only preferred.
More information about the systemd-devel
mailing list