Projet

Général

Profil

Télécharger (12,4 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / etc / rc @ 1a7ed9d0

1 5b237745 Scott Ullrich
#!/bin/sh
2
3 3b6a207d Scott Ullrich
# $Id$
4
5 e5cd29a0 Scott Ullrich
# /etc/rc - master bootup script, invokes php setup
6
# part of pfSense by Scott Ullrich
7 8ad39798 Scott Ullrich
# Copyright (C) 2004-2010 Scott Ullrich, All rights reserved.
8 e5cd29a0 Scott Ullrich
# originally based on m0n0wall (http://neon1.net/m0n0wall)
9 5b237745 Scott Ullrich
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
# All rights reserved.
11 d8a2ce2c Scott Ullrich
12
#/bin/stty status '^T'
13
#/bin/stty susp '^-' intr '^-' quit '^-'
14
15
#trap : 2
16
#trap : 3
17 5b237745 Scott Ullrich
18
HOME=/
19 ce823053 Scott Ullrich
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
20 5b237745 Scott Ullrich
export HOME PATH
21
22 1c44a77d Scott Ullrich
# Set our operating platform
23 e8d0903d Ermal
PLATFORM=`/bin/cat /etc/platform`
24 1c44a77d Scott Ullrich
25 842878b5 Scott Ullrich
# Set our current version
26 e8d0903d Ermal
version=`/bin/cat /etc/version`
27 842878b5 Scott Ullrich
28 e5323cca jim-p
# Setup dumpdev/ddb/savecore"
29
echo "Configuring crash dumps..."
30
if [ "$PLATFORM" = "pfSense" ]; then
31
	/etc/rc.dumpon
32
fi
33
34 990fa101 jim-p
if [ -e /root/force_fsck ]; then
35
	echo "Forcing filesystem check..."
36 ac62a50d Ermal
	/sbin/fsck -y -t ufs /
37 990fa101 jim-p
	if [ "$PLATFORM" = "nanobsd" ]; then
38 ac62a50d Ermal
		/sbin/fsck -y -t ufs /cf
39 990fa101 jim-p
	fi
40
fi
41
42 302c005e Ermal
if [ "${PLATFORM}" = "nanobsd" ]; then
43
	kldstat -qm zfs
44
	if [ $? = 0 ]; then
45
		kldunload zfs
46
	fi
47
fi
48
49 c4995e62 Chris Buechler
# Mount memory file system if it exists
50 8022e257 Scott Ullrich
echo "Mounting filesystems..."
51 842878b5 Scott Ullrich
52 302c005e Ermal
kldstat -qm zfs
53 87db1017 Scott Ullrich
# Handle ZFS read-only case
54 6bc46900 Scott Ullrich
if [ "$PLATFORM" = "pfSense" ]; then
55 302c005e Ermal
	kldstat -qm zfs
56
	if [ $? = 0 ]; then
57
		ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
58
		if [ $ZFSAVAILABLE -eq 0 ]; then
59
			kldunload zfs
60
		elif [ -f /usr/bin/grep ]; then
61
			ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
62
			if [ "$ZFSROOT" != "" ]; then
63
				/sbin/zfs set readonly=off $ZFSROOT
64
			fi
65 6bc46900 Scott Ullrich
		fi
66 8a8f51b7 Scott Ullrich
	fi
67 87db1017 Scott Ullrich
fi
68
69 e92e83d4 jim-p
if [ "${PLATFORM}" = "cdrom" ]; then
70 842878b5 Scott Ullrich
	/etc/rc.cdrom
71 e92e83d4 jim-p
else
72
	# Mount /. If it fails run a fsck.
73 ce8efd06 Scott Ullrich
	if [ "$PLATFORM" = "nanobsd" ]; then
74 e92e83d4 jim-p
		export PKG_TMPDIR=/root/
75 f5813962 Renato Botelho
		/sbin/mount -uw / 2>/dev/null
76
		mount_rc=$?
77
		attempts=0
78
		while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
79
			/sbin/fsck -y /
80
			/sbin/fsck -y /cf
81
			/sbin/mount -uw / 2>/dev/null
82
			mount_rc=$?
83
			attempts=$((attempts+1))
84
		done
85
	else
86
		/sbin/mount -a 2>/dev/null
87
		mount_rc=$?
88
		attempts=0
89
		while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
90
			/sbin/fsck -y /
91
			/sbin/mount -a 2>/dev/null
92
			mount_rc=$?
93
			attempts=$((attempts+1))
94
		done
95 ce8efd06 Scott Ullrich
	fi
96 e92e83d4 jim-p
97 842878b5 Scott Ullrich
	# If /conf is a directory, convert it to a symlink to /cf/conf
98 c4995e62 Chris Buechler
	if [ -d "/conf" ]; then
99
		# If item is not a symlink then rm and recreate
100
		CONFPOINTSTO=`readlink /conf` 
101
		if ! test "x$CONFPOINTSTO" = "x/cf/conf"; then 
102 e8d0903d Ermal
			/bin/rm -rf /conf
103
			/bin/ln -s /cf/conf /conf
104 c4995e62 Chris Buechler
		fi
105
	fi
106 efc0e29a jim-p
107
	if [ ! "$PLATFORM" = "jail" ]; then
108
		# Check to see if a compact flash mountpoint exists
109 ac62a50d Ermal
		# If it fails to mount then run a fsck -y
110 efc0e29a jim-p
		if grep -q cf /etc/fstab; then
111
			/sbin/mount -w /cf 2>/dev/null
112 f5813962 Renato Botelho
			/sbin/mount -uw /cf 2>/dev/null
113
			mount_rc=$?
114
			attempts=0
115
			while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
116
				/sbin/umount /cf
117
				/sbin/fsck -y /cf
118
				/sbin/mount -w /cf 2>/dev/null
119
				mount_rc=$?
120
				attempts=$((attempts+1))
121
			done
122 efc0e29a jim-p
		fi
123
	fi
124
125
	USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml`
126 e61f548f Ermal
	if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
127 efc0e29a jim-p
		/etc/rc.embedded
128
	fi
129 c4995e62 Chris Buechler
fi
130
131 990fa101 jim-p
/bin/rm -f /root/force_fsck
132 2085c6de jim-p
/bin/rm -f /root/TRIM_set
133
/bin/rm -f /root/TRIM_unset
134
135 92ac3b3d jim-p
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles.
136 06fd1952 Ermal
if [ -f /etc/rc.disable_hdd_apm ]; then
137
	/etc/rc.disable_hdd_apm
138
fi
139 92ac3b3d jim-p
140 793d3c96 smos
#Eject CD devices on 3G modems
141 2f8782fe smos
MANUFACTURER="huawei|zte"
142
CDDEVICE=`dmesg |egrep -ie "($MANUFACTURER)" | awk -F: '/cd/ {print $1}'`
143
if [ "$CDDEVICE" != "" ]; then
144
	cdcontrol -f /dev/"$CDDEVICE" eject
145
fi
146 793d3c96 smos
147 ca3537ba jim-p
# sync pw database after mount.
148 01656166 jim-p
rm -f /etc/spwd.db.tmp
149
/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd
150 ca3537ba jim-p
151 e8d0903d Ermal
product=`/usr/bin/grep product_name /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
152
hideplatform=`/usr/bin/grep hideplatform /etc/inc/globals.inc | /usr/bin/wc -l`
153
varrunpath=`/usr/bin/grep varrun_path /etc/inc/globals.inc | /usr/bin/cut -d'"' -f4`
154 3d7639eb Scott Ullrich
155 b6a63312 jim-p
if [ "$PLATFORM" = "pfSense" ] && [ ${USE_MFS_TMPVAR} -eq 0 ]; then
156 7d3be92f Ermal
	/sbin/mdmfs -S -M -s 4m md $varrunpath
157
fi
158
159 6fafc69f Scott Ullrich
if [ "$hideplatform" -gt "0" ]; then
160 3d7639eb Scott Ullrich
	platformbanner="" # hide the platform
161
else
162
	platformbanner=" on the '${PLATFORM}' platform"
163
fi
164 1c44a77d Scott Ullrich
165
echo
166
cat /etc/ascii-art/pfsense-logo-small.txt
167
echo
168
echo
169 ba2cbed4 Scott Ullrich
echo "Welcome to ${product} ${version} ${platformbanner} ..."
170 1c44a77d Scott Ullrich
echo
171
172 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
173
	# Enable console output if its muted.
174
	/sbin/conscontrol mute off >/dev/null
175
fi
176 d5f60dba Scott Ullrich
177 5621d2d5 Scott Ullrich
if [ "$PLATFORM" = "cdrom" ] ; then
178
	# do nothing for cdrom platform
179 e92e83d4 jim-p
elif [ "$PLATFORM" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
180 152c18f0 Phil Davis
	# Ensure that old-style PKG packages can be persistent across reboots
181 cd465e06 Scott Ullrich
	/bin/mkdir -p /root/var/db/pkg
182 e8d0903d Ermal
	/bin/rm -rf /var/db/pkg
183
	/bin/ln -s /root/var/db/pkg/ /var/db/pkg
184 152c18f0 Phil Davis
	# Ensure that PBI packages can be persistent across reboots
185
	/bin/mkdir -p /root/var/db/pbi
186
	/bin/rm -rf /var/db/pbi
187
	/bin/ln -s /root/var/db/pbi/ /var/db/pbi
188 7734aea6 Andrew Thompson
elif [ "$PLATFORM" = "jail" ]; then
189
	# do nothing for jail platform
190 c0819d14 Jeb Campbell
else
191 3b39d0ac jim-p
	SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
192
	/sbin/swapon -a 2>/dev/null >/dev/null
193 e5323cca jim-p
	/etc/rc.savecore
194 e92e83d4 jim-p
195
	if [ -d /root/var/db/pkg ]; then
196
		# User must have just disabled RAM disks, move these back into place.
197
		/bin/mkdir -p /var/db/pkg
198
		/bin/mv /root/var/db/pkg /var/db/pkg
199
		/bin/mkdir -p /var/db/pbi
200
		/bin/mv /root/var/db/pkg /var/db/pbi
201
	fi
202 98546a74 Scott Ullrich
fi
203 5621d2d5 Scott Ullrich
204 12bf92ca Scott Ullrich
if [ "$PLATFORM" = "cdrom" ] ; then
205 df40aa86 Scott Ullrich
	echo -n "Mounting unionfs directories..."
206 e8d0903d Ermal
	/bin/mkdir /tmp/unionfs
207
	/bin/mkdir /tmp/unionfs/usr
208
	/bin/mkdir /tmp/unionfs/root
209
	/bin/mkdir /tmp/unionfs/sbin
210
	/bin/mkdir /tmp/unionfs/bin
211
	/bin/mkdir /tmp/unionfs/boot
212
	/bin/mkdir /tmp/unionfs/confdefault
213
	/sbin/mount_unionfs /tmp/unionfs/usr /usr/
214
	/sbin/mount_unionfs /tmp/unionfs/root /root/
215
	/sbin/mount_unionfs /tmp/unionfs/bin /bin/		
216
	/sbin/mount_unionfs /tmp/unionfs/sbin /sbin/	
217
	/sbin/mount_unionfs /tmp/unionfs/boot /boot/
218
	/sbin/mount_unionfs /tmp/unionfs/confdefault /conf.default/
219 df40aa86 Scott Ullrich
	echo "done."
220 12bf92ca Scott Ullrich
fi
221
222 080b4ce1 Ermal
# make some directories in /var
223
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/at/jobs/ /var/empty 2>/dev/null
224
/bin/rm -rf $varrunpath/*
225
if [ "$PLATFORM" != "pfSense" ]; then
226
	/bin/rm /var/log/* 2>/dev/null
227
fi
228
229 9e9bc51c Ermal
# Cleanup configuration files from previous instance
230
/bin/rm -rf /var/etc/*
231 24450773 Ermal
/bin/rm -rf /var/tmp/*
232 9e9bc51c Ermal
233 2e269da2 Scott Ullrich
echo -n "Creating symlinks..."
234 803c0401 Scott Ullrich
# Make sure symlink is correct on nanobsd
235
if [ "$PLATFORM" = "nanobsd" ] ; then
236 e8d0903d Ermal
	/bin/rm /conf
237
	/bin/ln -s /cf/conf/ /conf
238 803c0401 Scott Ullrich
fi
239
240 6bab150e Scott Ullrich
# Repair symlinks if they are broken
241 080b4ce1 Ermal
if [ -f /etc/newsyslog.conf ]; then
242
	/bin/rm -f /etc/newsyslog.conf
243
fi
244 6bab150e Scott Ullrich
if [ ! -L /etc/syslog.conf ]; then
245 e8d0903d Ermal
	/bin/rm -rf /etc/syslog.conf
246 9e9bc51c Ermal
	if [ ! -f /var/etc/syslog.conf ]; then
247
		touch /var/etc/syslog.conf
248
	fi
249 e8d0903d Ermal
	/bin/ln -s /var/etc/syslog.conf /etc/syslog.conf
250 6bab150e Scott Ullrich
fi
251
252 f1cc2287 Scott Ullrich
# Repair symlinks if they are broken
253
if [ ! -L /etc/hosts ]; then
254 e8d0903d Ermal
	/bin/rm -rf /etc/hosts
255
	/bin/ln -s /var/etc/hosts /etc/hosts
256 c8fcdb2f Scott Ullrich
fi
257 095d04db Scott Ullrich
258 f1cc2287 Scott Ullrich
if [ ! -L /etc/resolv.conf ]; then
259 e8d0903d Ermal
    /bin/rm -rf /etc/resolv.conf
260
    /bin/ln -s /var/etc/resolv.conf /etc/resolv.conf
261 f1cc2287 Scott Ullrich
fi
262 095d04db Scott Ullrich
263 230787e7 Scott Ullrich
# Setup compatibility link for packages that
264
# have trouble overriding the PREFIX configure
265
# argument since we build our packages in a
266 5aa68a55 Renato Botelho
# separated PREFIX area
267 eb03f14e Chris Buechler
# Only create if symlink does not exist. 
268
if [ ! -h /tmp/tmp ]; then
269 e8d0903d Ermal
    /bin/ln -hfs / /tmp/tmp
270 eb03f14e Chris Buechler
fi
271 230787e7 Scott Ullrich
272 4be3f6cf Seth Mos
# Make sure our /tmp is 777 + Sticky
273 3fb8caf2 Scott Ullrich
if [ ! "$PLATFORM" = "cdrom" ] ; then
274 e8d0903d Ermal
	/bin/rm -rf /tmp/*
275 3fb8caf2 Scott Ullrich
fi
276 e8d0903d Ermal
/bin/chmod 1777 /tmp
277 0652f3ae Seth Mos
278 dd64811a Scott Ullrich
if [ ! "$PLATFORM" = "cdrom" ] ; then
279
	# Malloc debugging check
280
	if [ -L /etc/malloc.conf ]; then
281
	    #ln -s aj /etc/malloc.conf
282 e8d0903d Ermal
		/bin/rm /etc/malloc.conf
283 dd64811a Scott Ullrich
	fi
284 cecdf31c Scott Ullrich
fi
285
286 6484bb83 Scott Ullrich
if [ ! -L /etc/dhclient.conf ]; then
287 e8d0903d Ermal
    /bin/rm -rf /etc/dhclient.conf
288 6484bb83 Scott Ullrich
fi
289 c8fcdb2f Scott Ullrich
290 544156a7 Scott Ullrich
if [ ! -d /var/tmp ]; then
291 e8d0903d Ermal
	/bin/mkdir -p /var/tmp
292 544156a7 Scott Ullrich
fi
293 4aa70cd8 Scott Ullrich
294 544156a7 Scott Ullrich
if [ ! -d /cf/conf/backup/ ]; then
295 e8d0903d Ermal
	/bin/mkdir -p /cf/conf/backup/ 
296 544156a7 Scott Ullrich
fi
297 d42c2e20 Scott Ullrich
298 5b237745 Scott Ullrich
set -T
299
trap "echo 'Reboot interrupted'; exit 1" 3
300
301 61f1e2ec Scott Ullrich
# Remove old nameserver resolution files
302 e8d0903d Ermal
/bin/rm -f /var/etc/nameserver*
303 61f1e2ec Scott Ullrich
304 f3677fc5 Scott Ullrich
# Create uploadbar tmp directory
305 e8d0903d Ermal
/bin/mkdir -p /tmp/uploadbar
306
/bin/chmod 0777 /tmp/uploadbar
307 f3677fc5 Scott Ullrich
308 2e269da2 Scott Ullrich
echo -n "."
309 71bdd226 Warren Baker
DISABLESYSLOGCLOG=`/usr/bin/grep -c disablesyslogclog /cf/conf/config.xml`
310
ENABLEFIFOLOG=`/usr/bin/grep -c usefifolog /cf/conf/config.xml`
311 e0c45357 jim-p
LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppp relayd wireless lighttpd ntpd gateways resolver routing"
312 c7a3356e jim-p
313
DEFAULT_LOG_FILE_SIZE=`/usr/local/bin/xmllint --xpath 'string(//pfsense/syslog/logfilesize)' /conf/config.xml`
314
if [ ! ${DEFAULT_LOG_FILE_SIZE} ]; then
315
	DEFAULT_LOG_FILE_SIZE=511488
316
fi
317
318 973b2663 Ermal
for logfile in $LOG_FILES; do
319
	if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then 
320
		/usr/bin/touch /var/log/$logfile.log
321 8274afc7 Scott Ullrich
	else 
322 973b2663 Ermal
		if [ ! -f /var/log/$logfile.log ]; then
323
			if [ "$ENABLEFIFOLOG" -gt "0" ]; then
324
				# generate fifolog files
325 c7a3356e jim-p
				/usr/sbin/fifolog_create -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
326 973b2663 Ermal
			else 
327 2a50fd8a Renato Botelho
				/usr/local/sbin/clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
328 973b2663 Ermal
			fi
329 e8197e56 Ermal
		fi
330 973b2663 Ermal
	fi 
331
done
332
333 57ecd9b6 Scott Ullrich
# change permissions on newly created fifolog files.
334 e8d0903d Ermal
/bin/chmod 0600 /var/log/*.log
335 8d418ca9 Scott Ullrich
336 2e269da2 Scott Ullrich
echo -n "."
337 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
338
	DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8`
339
	if [ "$DEVFS" = "0" ]; then
340
		mount_devfs devfs /dev
341
	fi
342 f93c5384 Scott Ullrich
fi
343 5b237745 Scott Ullrich
344
# Create an initial utmp file
345 7d3be92f Ermal
cd $varrunpath && /bin/cp /dev/null utmp && /bin/chmod 644 utmp
346 5b237745 Scott Ullrich
347 2e269da2 Scott Ullrich
echo -n "."
348 6fe4f291 Scott Ullrich
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
349 05dd0c32 Ermal
/etc/rc.d/ldconfig start 2>/dev/null
350 c268f10f Scott Ullrich
351 cdbc61b6 Scott Ullrich
# Make sure /etc/rc.conf doesn't exist.
352
if [ -f /etc/rc.conf ]; then
353 e8d0903d Ermal
    /bin/rm -rf /etc/rc.conf
354 cdbc61b6 Scott Ullrich
fi
355
356 7734aea6 Andrew Thompson
if [ ! "$PLATFORM" = "jail" ]; then
357
	# Launching kbdmux(4)
358
	if [ -f "/dev/kbdmux0" ]; then
359
		echo -n "."
360
		/usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console
361
		[ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console
362
		[ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console
363
	fi
364 4e7b2b27 Scott Ullrich
365 7734aea6 Andrew Thompson
	# Fire up unionfs if mount points exist.
366
	if [ -f /dist/uniondirs ]; then
367
		echo -n "."
368
		/etc/rc.d/unionfs start
369
	fi
370 b1ce7649 Scott Ullrich
fi
371 fa8f44ce Scott Ullrich
372 2e269da2 Scott Ullrich
echo "done."
373 deff30cd Scott Ullrich
374 64183253 Scott Ullrich
# Ensure gettytab is of a sane size
375
if [ `/bin/ls -la /etc/gettytab | /usr/bin/awk '{ print $5'}` -lt 512 ]; then
376 9c3b8c6e Chris Buechler
	echo ">>> Restoring /etc/gettytab due to unusual size"
377
	echo ">>> Restoring /etc/gettytab due to unusual size" | /usr/bin/logger
378 416e6432 Ermal
	/bin/cp /etc/gettytab.bak /etc/gettytab
379 64183253 Scott Ullrich
fi
380
381 ad0d7518 Scott Ullrich
# Recreate capabilities DB
382 416e6432 Ermal
/usr/bin/cap_mkdb /etc/login.conf
383 ad0d7518 Scott Ullrich
384 40e46009 Scott Ullrich
# Run the php.ini setup file and populate
385
# /usr/local/etc/php.ini and /usr/local/lib/php.ini
386 aa840cf9 Scott Ullrich
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt
387 4aea91d8 Ermal
/usr/local/sbin/php-fpm -c /usr/local/lib/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null
388 0cf5aa69 Scott Ullrich
389 206f684d Scott Ullrich
# Launch external configuration loader for supported platforms
390
if [ "$PLATFORM" = "nanobsd" ]; then
391 1590947b Ermal
	/usr/local/sbin/fcgicli -f /etc/ecl.php
392 206f684d Scott Ullrich
fi
393
394
# Launch external configuration loader for supported platforms
395
if [ "$PLATFORM" = "pfSense" ]; then
396 1590947b Ermal
	/usr/local/sbin/fcgicli -f /etc/ecl.php
397 206f684d Scott Ullrich
fi
398
399 490615d3 Scott Ullrich
if [ -f /etc/rc.custom_boot_early ]; then
400
	/bin/echo -n "Launching /etc/rc.custom_boot_early...";
401
	/etc/rc.custom_boot_early
402
	echo "Done"
403
fi
404
405 4aea91d8 Ermal
export fcgipath=/var/run/php-fpm.socket
406 01599e5e Ermal
/usr/bin/nice -n20 /usr/local/sbin/check_reload_status
407 e8d0903d Ermal
408 b406ae66 Scott Ullrich
# let the PHP-based configuration subsystem set up the system now
409 8e2eb65e Scott Ullrich
echo -n "Launching the init system..."
410 e8d0903d Ermal
/bin/rm -f /cf/conf/backup/backup.cache
411
/bin/rm -f /root/lighttpd*
412
/usr/bin/touch $varrunpath/booting
413 b406ae66 Scott Ullrich
/etc/rc.bootup
414
415 5551d818 Renato Botelho
# /etc/rc.bootup unset $g['booting'], remove file right now to be
416
# consistent
417
/bin/rm $varrunpath/booting
418
419 c1da5030 Scott Ullrich
# If a shell was selected from recovery 
420
# console then just drop to the shell now.
421
if [ -f "/tmp/donotbootup" ]; then
422 b1d04497 Scott Ullrich
	echo "Dropping to recovery shell."
423 c1da5030 Scott Ullrich
	exit 0
424
fi
425
426 0c5e431d Scott Ullrich
echo -n "Starting CRON... "
427 ea83ac64 Scott Ullrich
cd /tmp && /usr/sbin/cron -s 2>/dev/null
428 0c5e431d Scott Ullrich
echo "done."
429 3e08b3c1 Scott Ullrich
430 5be5825e Scott Ullrich
# Start packages
431 1590947b Ermal
/usr/local/sbin/fcgicli -f /etc/rc.start_packages
432 3bd1bd72 Scott Ullrich
433 e8d0903d Ermal
/bin/rm -rf /usr/local/pkg/pf/CVS
434 bc086d51 Scott Ullrich
435 0092b3bd mgrooms
# Start ping handler every 240 seconds
436 7d3be92f Ermal
/usr/local/bin/minicron 240 $varrunpath/ping_hosts.pid /usr/local/bin/ping_hosts.sh
437 f2025e91 Scott Ullrich
438 0092b3bd mgrooms
# Start account expire handler every hour
439 1590947b Ermal
/usr/local/bin/minicron 3600 $varrunpath/expire_accounts.pid '/usr/local/sbin/fcgicli -f /etc/rc.expireaccounts'
440 0092b3bd mgrooms
441 f6ba4bd1 Scott Ullrich
# Start alias url updater every 24 hours
442 1590947b Ermal
/usr/local/bin/minicron 86400 $varrunpath/update_alias_url_data.pid '/usr/local/sbin/fcgicli -f /etc/rc.update_alias_url_data'
443 f6ba4bd1 Scott Ullrich
444 c432da9c Scott Ullrich
/bin/chmod a+rw /tmp/.
445 b569598b Scott Ullrich
446 52398a6b jim-p
# Check for GEOM mirrors
447
GMIRROR_STATUS=`/sbin/gmirror status`
448
if [ "${GMIRROR_STATUS}" != "" ]; then
449
	# Using a flag file at bootup saves an expensive exec/check on each page load.
450
	/usr/bin/touch /var/run/gmirror_active
451
	# Setup monitoring/notifications
452
	/usr/local/bin/minicron 60 /var/run/gmirror_status_check.pid /usr/local/sbin/gmirror_status_check.php
453
fi
454
455 1a7ed9d0 Adam Gibson
# Log product version to syslog
456 01deca6a Adam Gibson
BUILDTIME=`cat /etc/version.buildtime`
457
ARCH=`uname -m`
458 05b69065 Adam Gibson
echo "$product ($PLATFORM) $version $ARCH $BUILDTIME"
459 01deca6a Adam Gibson
460 e393a4a8 Scott Ullrich
echo "Bootup complete"
461 1ba9533c Scott Ullrich
462 2d4be1c5 Scott Ullrich
/usr/local/bin/beep.sh start 2>&1 >/dev/null
463 e393a4a8 Scott Ullrich
464 4171fa68 Scott Ullrich
# Reset the cache.  read-only requires this.
465 7734aea6 Andrew Thompson
/bin/rm -f /tmp/config.cache
466 4171fa68 Scott Ullrich
467 d35cf0de Scott Ullrich
exit 0