Ubuntu 8.04 wont reboot from script
Posted
by Littlejon
on Server Fault
See other posts from Server Fault
or by Littlejon
Published on 2010-06-02T21:44:00Z
Indexed on
2010/06/02
21:56 UTC
Read the original article
Hit count: 247
I have a script that is run to backup a server via Rsync, after that script is run I want the server to reboot.
My script is run as root from the Crontab at 3am in the morning.
#!/bin/bash
HOST="email"
RSYNC_OPTS="-a -v -v --progress --stats --delete"
RSYNC_DEST="10.0.0.10::$HOST"
BACKUP_LIST="/etc /home /root"
TIMESTAMP="/timestamp-bkup-start.chk"
TIMESTAMP2="/timestamp-bkup-stop.chk"
touch $TIMESTAMP
rsync $RSYNC_OPTS $TIMESTAMP $RSYNC_DEST
for BACKUP_ITEM in $BACKUP_LIST;
do
rsync $RSYNC_OPTS $BACKUP_ITEM $RSYNC_DEST
done
/etc/init.d/zimbra stop
sleep 60s
rsync $RSYNC_OPTS /opt $RSYNC_DEST
touch $TIMESTAMP2
rsync $RSYNC_OPTS $TIMESTAMP2 $RSYNC_DEST
echo `date +%Y%m%d%H%M` >> /var/log/reset
reboot
# $# shows number of args passed
# $1 to access first variable
#if [ $# -eq 1 ]; then
# if [ $1 = "withreboot" ]; then
# echo "rebooting...";
# echo `date +%Y%m%d%H%M` >> /var/log/reset
# /sbin/reboot
# fi
#fi
I have tried using init 6 rather then reboot. I have tried /sbin/reboot.
I also have another basic script that just echos to the reset log and runs reboot without issue. It is just with the script above the server wont restart.
If anyone has any theories that would be great as I have run out of idea.
Thanks,
Jon
© Server Fault or respective owner