Project

General

Profile

Download (1.62 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# rc.reboot
4
#
5
# part of pfSense (https://www.pfsense.org)
6
# Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
# All rights reserved.
8
#
9
# 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
#
13
# http://www.apache.org/licenses/LICENSE-2.0
14
#
15
# 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

    
21
if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then
22
	echo "Cannot reboot at this moment, a config write operation is in progress, and 30 seconds have passed."
23
	exit 1
24
fi
25

    
26
sleep 1
27

    
28
# Read product_name from $g, defaults to pfSense
29
product=$(/usr/local/sbin/read_global_var product_name pfSense)
30

    
31
# Remove temporary files on shutdown from /tmp/
32
rm -rf /tmp/*
33

    
34
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
35
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
36
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
37
# 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...
38
if [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
39
	/etc/rc.backup_aliastables.sh
40
	/etc/rc.backup_rrd.sh
41
	/etc/rc.backup_dhcpleases.sh
42
fi
43

    
44
sleep 1
45

    
46
SHUTDOWN=/sbin/shutdown
47
$SHUTDOWN -r now
(63-63/77)