Solved Periodic Problems

Howdy folks,

I have a little predicament with periodic.
I installed rsnapshot to make backups and I start it via periodic(8)

The backup is executed without errors and on time (daily | weekly | monthly).
So far so good...
However, periodic sends me an email after every run with the following content:

Code:
Date: Mon, 08 Jun 2020 02:00:00 +0200
From: Cron Daemon <root@beast.darktemple.ch>
To: root
Subject: Cron <root@beast> root    /usr/sbin/periodic daily

/bin/sh: root: not found

As I mentioned, the backups run without a problem.
What am I doing wrong?
Here's a list of all the files involved:

root's crontab:
Bash:
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
0      2       *       *       *       root    /usr/sbin/periodic daily
0      3       *       *       6       root    /usr/sbin/periodic weekly
0      5       1       *       *       root    /usr/sbin/periodic monthly

/usr/local/etc/periodic/monthly/111.rsnapshot:
Bash:
#!/bin/sh -
# NOTE: '-' makes sh a login shell
# /usr/local/etc/periodic/monthly/111.rsnapshot
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin

if [ -r /etc/defaults/periodic.conf ]; then
        . /etc/defaults/periodic.conf
        source_periodic_confs
fi

rc=0

rsnapshot_daily() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf daily
    return $?
}

rsnapshot_weekly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf weekly
    return $?
}

rsnapshot_monthly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf monthly
    return $?
}

rsnapshot_monthly
rc=$?
exit $rc

/usr/local/etc/periodic/weekly/111.rsnapshot
Bash:
#!/bin/sh -
# NOTE: '-' makes sh a login shell
# /usr/local/etc/periodic/weekly/111.rsnapshot
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin

if [ -r /etc/defaults/periodic.conf ]; then
        . /etc/defaults/periodic.conf
        source_periodic_confs
fi

rc=0

rsnapshot_daily() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf daily
    return $?
}

rsnapshot_weekly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf weekly
    return $?
}

rsnapshot_monthly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf monthly
    return $?
}

rsnapshot_weekly
rc=$?
exit $rc

/usr/local/etc/periodic/daily/111.rsnapshot
Bash:
#!/bin/sh -
# NOTE: '-' makes sh a login shell
# /usr/local/etc/periodic/daily/111.rsnapshot
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin

if [ -r /etc/defaults/periodic.conf ]; then
        . /etc/defaults/periodic.conf
        source_periodic_confs
fi

rc=0

rsnapshot_daily() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf daily
    return $?
}

rsnapshot_weekly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf weekly
    return $?
}

rsnapshot_monthly() {
    /usr/local/bin/rsnapshot -c /usr/local/etc/rsnapshot.conf monthly
    return $?
}

rsnapshot_daily
rc=$?
exit $rc

What am I doing wrong here?

Greetings and thanks in advance! :cool:
 
root's crontab:
You mean crontab -e or /etc/crontab? Those are two different types of crontab. The periodic(8) scripts are already started through /etc/crontab:
Code:
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
You do not need to add them to root's crontab (which is actually /var/cron/tabs/root). A user's crontab (root is a user after all) doesn't include the account, since that's already implied.
 
You mean crontab -e or /etc/crontab?
Well.... I did crontab -e as root, thinking that that would be the same.
Apparently it isn't.

I now removed everything in crontab -e.
I'll report back tomorrow to tell you if that already fixed the problem :)
 
Back
Top