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
|
product=`cat /etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
|
9
|
|
10
|
echo
|
11
|
echo "${product} is now shutting down ..."
|
12
|
echo
|
13
|
|
14
|
stty status '^T'
|
15
|
|
16
|
# Set shell to ignore SIGINT (2), but not children;
|
17
|
trap : 2
|
18
|
|
19
|
HOME=/; export HOME
|
20
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
21
|
export PATH
|
22
|
|
23
|
# If PLATFORM is pfSense then remove
|
24
|
# temporary files on shutdown from /tmp/
|
25
|
PLATFORM=`cat /etc/platform`
|
26
|
if [ "$PLATFORM" = "pfSense" ]; then
|
27
|
find -x /tmp/* -type f -exec rm -f {} \;
|
28
|
else
|
29
|
/etc/rc.backup_rrd.sh
|
30
|
/etc/rc.backup_dhcpleases.sh
|
31
|
fi
|