This cannot be expressed in the typical crontab syntax, so we run a script every sunday in the crontab:
00 11 kraftek.html POSTS rescue rescued.html rescued.txt x y z kraftek.html POSTS rescue rescued.html rescued.txt x y z 0 root /scripts/monthlyreboot.ksh > /var/log/rebootlog 2>&1
The script checks if this is the first sunday of the current month, if it is, it performs a reboot, the contents of
/scripts/monthlyreboot.ksh are:
#!/bin/ksh
# get today’s month and year
T=`date +%m” “%Y | sed ‘s/^0//’`
# get this month’s first sunday
S=`cal $T | cut -c 1-2 | sed ‘s/ //g’ | grep . | head -2 | tail -1`
# get what day of the month today is
D=`date +%d | sed ‘s/^0//’`
echo -n “`date` — the day is $D, first sunday of $T is $S”
if [ $D -eq $S ];then
echo “, so we are going to reboot”
sleep 3
/sbin/shutdown -t 00 -r now
else
echo “, no reboot today”
fi