1
|
#!/bin/sh
|
2
|
|
3
|
# $Id$
|
4
|
|
5
|
if [ -f /var/run/config.lock ]; then
|
6
|
echo "Cannot reboot at this moment, a config write operation is in progress."
|
7
|
exit -1
|
8
|
fi
|
9
|
|
10
|
sleep 1
|
11
|
|
12
|
# If PLATFORM is pfSense then remove
|
13
|
# temporary files on shutdown from /tmp/
|
14
|
PLATFORM=`cat /etc/platform`
|
15
|
if [ "$PLATFORM" = "pfSense" ]; then
|
16
|
rm -rf /tmp/*
|
17
|
else
|
18
|
/etc/rc.conf_mount_rw
|
19
|
# Save the rrd databases to the config path.
|
20
|
cd / && tar -czf /cf/conf/rrd.tgz -C / var/db/rrd/*.rrd
|
21
|
/etc/rc.conf_mount_ro
|
22
|
fi
|
23
|
|
24
|
sleep 1
|
25
|
|
26
|
SHUTDOWN=/sbin/shutdown
|
27
|
if [ -f /sbin/shutdown.old ]; then
|
28
|
SHUTDOWN=/sbin/shutdown.old
|
29
|
fi
|
30
|
|
31
|
$SHUTDOWN -r now
|