Project

General

Profile

Download (1.83 KB) Statistics
| Branch: | Tag: | Revision:
1 0c48d845 Scott Ullrich
#!/bin/sh
2 ac24dc24 Renato Botelho
#
3
# pfSense-rc.shutdown
4
#
5
# part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
# Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 ac24dc24 Renato Botelho
# All rights reserved.
8
#
9 b12ea3fb Renato Botelho
# Licensed under the Apache License, Version 2.0 (the "License");
10
# you may not use this file except in compliance with the License.
11
# You may obtain a copy of the License at
12 ac24dc24 Renato Botelho
#
13 b12ea3fb Renato Botelho
# http://www.apache.org/licenses/LICENSE-2.0
14 ac24dc24 Renato Botelho
#
15 b12ea3fb Renato Botelho
# Unless required by applicable law or agreed to in writing, software
16
# distributed under the License is distributed on an "AS IS" BASIS,
17
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
# See the License for the specific language governing permissions and
19
# limitations under the License.
20 5b237745 Scott Ullrich
21 7201ca27 jim-p
if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then
22
	echo "Cannot shutdown at this moment, a config write operation is in progress and 30 seconds have passed."
23 6995b4fc Scott Ullrich
	exit -1
24
fi
25
26 e4121dde Renato Botelho
# Read product_name from $g, defaults to pfSense
27
product=$(/usr/local/sbin/read_global_var product_name pfSense)
28 e173dd74 Phil Davis
29 153c8601 Scott Ullrich
echo
30 f51db33f Scott Ullrich
echo "${product} is now shutting down ..."
31 153c8601 Scott Ullrich
echo
32
33 0c48d845 Scott Ullrich
stty status '^T'
34 5b237745 Scott Ullrich
35
# Set shell to ignore SIGINT (2), but not children;
36 0c48d845 Scott Ullrich
trap : 2
37 5b237745 Scott Ullrich
38 0c48d845 Scott Ullrich
HOME=/; export HOME
39
PATH=/sbin:/bin:/usr/sbin:/usr/bin
40
export PATH
41 5b237745 Scott Ullrich
42 dc61252a Renato Botelho
# Remove temporary files on shutdown from /tmp/
43
find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1
44 e92e83d4 jim-p
45 a5c36eb2 Renato Botelho
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
46 e92e83d4 jim-p
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
47
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
48
# 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...
49 dc61252a Renato Botelho
if [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
50 03afdafa NOYB
	/etc/rc.backup_aliastables.sh
51 ef68d19c jim-p
	/etc/rc.backup_rrd.sh
52 6b5a20ab jim-p
	/etc/rc.backup_dhcpleases.sh
53 029d6129 NOYB
	/etc/rc.backup_logs.sh
54 99dc4c77 Scott Ullrich
fi