Projet

Général

Profil

Télécharger (1,18 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / etc / rc.shutdown @ master

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 {} \; >/dev/null 2>&1
28
fi
29

    
30
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml`
31
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
32
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
33
# 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...
34
if [ "${PLATFORM}" != "pfSense" ] || [ ${USE_MFS_TMPVAR} -gt 0 ] || [ "${DISK_TYPE}" = "md" ]; then
35
	/etc/rc.backup_rrd.sh
36
	/etc/rc.backup_dhcpleases.sh
37
fi
(92-92/103)