1
|
#!/bin/sh
|
2
|
|
3
|
if [ -f /var/run/config.lock ]; then
|
4
|
echo "Cannot reboot at this moment, a config write operation is in progress."
|
5
|
exit -1
|
6
|
fi
|
7
|
|
8
|
if [ -e /dev/ukbd0 ]; then
|
9
|
/usr/sbin/vidcontrol -s 2
|
10
|
fi
|
11
|
|
12
|
product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
|
13
|
|
14
|
echo
|
15
|
echo "${product} is now shutting down ..."
|
16
|
echo
|
17
|
|
18
|
stty status '^T'
|
19
|
|
20
|
# Set shell to ignore SIGINT (2), but not children;
|
21
|
trap : 2
|
22
|
|
23
|
HOME=/; export HOME
|
24
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
25
|
export PATH
|
26
|
|
27
|
# If PLATFORM is pfSense then remove
|
28
|
# temporary files on shutdown from /tmp/
|
29
|
PLATFORM=`cat /etc/platform`
|
30
|
if [ "$PLATFORM" = "pfSense" ]; then
|
31
|
rm -rf /tmp/*
|
32
|
else
|
33
|
/etc/rc.conf_mount_rw
|
34
|
# Save the rrd databases to the config path.
|
35
|
cd / && tar -czf /cf/conf/rrd.tgz -C / var/db/rrd/*.rrd
|
36
|
/etc/rc.conf_mount_ro
|
37
|
fi
|