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
|
# Read product_name from $g, defaults to pfSense
|
13
|
product=$(/usr/local/sbin/read_global_var product_name pfSense)
|
14
|
|
15
|
# If PLATFORM is $product then remove
|
16
|
# temporary files on shutdown from /tmp/
|
17
|
PLATFORM=`cat /etc/platform`
|
18
|
if [ "$PLATFORM" = "${product}" ]; then
|
19
|
rm -rf /tmp/*
|
20
|
fi
|
21
|
|
22
|
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
|
23
|
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
|
24
|
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
|
25
|
# 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...
|
26
|
if [ "${PLATFORM}" != "${product}" ] || [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
|
27
|
/etc/rc.backup_rrd.sh
|
28
|
/etc/rc.backup_dhcpleases.sh
|
29
|
fi
|
30
|
|
31
|
sleep 1
|
32
|
|
33
|
SHUTDOWN=/sbin/shutdown
|
34
|
if [ -f /sbin/shutdown.old ]; then
|
35
|
SHUTDOWN=/sbin/shutdown.old
|
36
|
fi
|
37
|
|
38
|
$SHUTDOWN -r now
|