1
|
#!/bin/sh
|
2
|
|
3
|
# $Id$
|
4
|
|
5
|
if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then
|
6
|
echo "Cannot reboot at this moment, a config write operation is in progress, and 30 seconds have passed."
|
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
|
fi
|
18
|
|
19
|
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml`
|
20
|
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
|
21
|
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
|
22
|
# If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot...
|
23
|
if [ "${PLATFORM}" != "pfSense" ] || [ ${USE_MFS_TMPVAR} -gt 0 ] || [ "${DISK_TYPE}" = "md" ]; then
|
24
|
/etc/rc.backup_rrd.sh
|
25
|
/etc/rc.backup_dhcpleases.sh
|
26
|
fi
|
27
|
|
28
|
sleep 1
|
29
|
|
30
|
SHUTDOWN=/sbin/shutdown
|
31
|
if [ -f /sbin/shutdown.old ]; then
|
32
|
SHUTDOWN=/sbin/shutdown.old
|
33
|
fi
|
34
|
|
35
|
$SHUTDOWN -r now
|