Project

General

Profile

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