I have created a --user service in systemd such that a non privileged user can manage a service. This works well. I wanted to restart the service at a fixed given time of day, so i created a cron job in the users crontab.
Strangely this does not work. The user can restart the service if they run:
systemctl --user restart myservice.service
However running this from the crontab does not restart the service. Does anyone know why?
This is running on Ubuntu 16.04.
crontab -l
. You have to execute it as user which have permissions to this service. The other question is: why do you want to restart it using cron?