cleanup rc.reboot ( same as rc.halt)

This commit is contained in:
Ad Schellevis 2015-03-31 10:06:40 +00:00
parent bd114c0d88
commit 85667d1cfb

View File

@ -1,11 +1,19 @@
#!/bin/sh
if ! /usr/bin/lockf -s -t 30 /tmp/config.lock /usr/bin/true; then
echo "Cannot reboot at this moment, a config write operation is in progress, and 30 seconds have passed."
exit 1
fi
# shutdown rc scripts
/usr/local/etc/rc.opnsense stop
/usr/local/etc/rc.backup_rrd
/usr/local/etc/rc.backup_dhcpleases
# wait for config lock to release
php -a >/dev/null << EOF
\$fp = fopen('/conf/config.xml', "w+");
if (flock(\$fp, LOCK_EX)) {
flock(\$fp, LOCK_UN);
fclose(\$fp);
}
EOF
/sbin/shutdown -or now