Project

General

Profile

Download (1.23 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2

    
3
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
	exit -1
6
fi
7

    
8
# Read product_name from $g, defaults to pfSense
9
product=$(/usr/local/sbin/read_global_var product_name pfSense)
10

    
11
echo
12
echo "${product} is now shutting down ..."
13
echo
14

    
15
stty status '^T'
16

    
17
# Set shell to ignore SIGINT (2), but not children;
18
trap : 2
19

    
20
HOME=/; export HOME
21
PATH=/sbin:/bin:/usr/sbin:/usr/bin
22
export PATH
23

    
24
# If PLATFORM is $product then remove
25
# temporary files on shutdown from /tmp/
26
PLATFORM=`cat /etc/platform`
27
if [ "$PLATFORM" = "${product}" ]; then
28
	find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1
29
fi
30

    
31
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
32
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
if [ "${PLATFORM}" != "${product}" ] || [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
36
	/etc/rc.backup_rrd.sh
37
	/etc/rc.backup_dhcpleases.sh
38
fi
(83-83/93)