1 |
0c48d845
|
Scott Ullrich
|
#!/bin/sh
|
2 |
5b237745
|
Scott Ullrich
|
|
3 |
7201ca27
|
jim-p
|
if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then
|
4 |
|
|
echo "Cannot shutdown at this moment, a config write operation is in progress and 30 seconds have passed."
|
5 |
6995b4fc
|
Scott Ullrich
|
exit -1
|
6 |
|
|
fi
|
7 |
|
|
|
8 |
e4121dde
|
Renato Botelho
|
# Read product_name from $g, defaults to pfSense
|
9 |
|
|
product=$(/usr/local/sbin/read_global_var product_name pfSense)
|
10 |
e173dd74
|
Phil Davis
|
|
11 |
153c8601
|
Scott Ullrich
|
echo
|
12 |
f51db33f
|
Scott Ullrich
|
echo "${product} is now shutting down ..."
|
13 |
153c8601
|
Scott Ullrich
|
echo
|
14 |
|
|
|
15 |
0c48d845
|
Scott Ullrich
|
stty status '^T'
|
16 |
5b237745
|
Scott Ullrich
|
|
17 |
|
|
# Set shell to ignore SIGINT (2), but not children;
|
18 |
0c48d845
|
Scott Ullrich
|
trap : 2
|
19 |
5b237745
|
Scott Ullrich
|
|
20 |
0c48d845
|
Scott Ullrich
|
HOME=/; export HOME
|
21 |
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
22 |
|
|
export PATH
|
23 |
5b237745
|
Scott Ullrich
|
|
24 |
c580e34c
|
Renato Botelho
|
# If PLATFORM is $product then remove
|
25 |
99dc4c77
|
Scott Ullrich
|
# temporary files on shutdown from /tmp/
|
26 |
|
|
PLATFORM=`cat /etc/platform`
|
27 |
c580e34c
|
Renato Botelho
|
if [ "$PLATFORM" = "${product}" ]; then
|
28 |
847fe304
|
Renato Botelho
|
find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1
|
29 |
e92e83d4
|
jim-p
|
fi
|
30 |
|
|
|
31 |
a5c36eb2
|
Renato Botelho
|
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
|
32 |
e92e83d4
|
jim-p
|
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
|
33 |
|
|
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
|
34 |
|
|
# 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...
|
35 |
a5c36eb2
|
Renato Botelho
|
if [ "${PLATFORM}" != "${product}" ] || [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
|
36 |
ef68d19c
|
jim-p
|
/etc/rc.backup_rrd.sh
|
37 |
6b5a20ab
|
jim-p
|
/etc/rc.backup_dhcpleases.sh
|
38 |
99dc4c77
|
Scott Ullrich
|
fi
|