User Tools

Site Tools



A system that goes to sleep (suspend) cannot run regularly scheduled cronjobs. Fortunately anacron is already installed, and runs the scripts in /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly in the hour after the system wakes up.

The problem is that these scripts run as root rather than a regular user. You can use sudo to run parts of the script as another user.


set -eo pipefail

sudo -u ian -i <<SUDO
<executed as non-privileged user>

Remember to chmod this shell script.

chmod u+x /etc/cron.daily/script
cron.daily.txt · Last modified: 2020/09/26 12:24 by ian

free spam filter