User Tools

Site Tools


cron.daily

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cron.daily [2020/09/26 12:24] (current)
ian created
Line 1: Line 1:
 +====== Anacron ======
 +
 +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.
 +
 +<code>
 +#!/bin/bash
 +
 +set -eo pipefail
 +
 +sudo -u ian -i <<SUDO
 +<executed as non-privileged user>
 +SUDO
 +</code>
 +
 +Remember to ''chmod'' this shell script.
 +
 +<code>
 +chmod u+x /etc/cron.daily/script
 +</code>
  
cron.daily.txt ยท Last modified: 2020/09/26 12:24 by ian

free spam filter