From 85667d1cfbf8f5c811c9a5441ccce57f0864acbc Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 31 Mar 2015 10:06:40 +0000 Subject: [PATCH] cleanup rc.reboot ( same as rc.halt) --- src/etc/rc.reboot | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/etc/rc.reboot b/src/etc/rc.reboot index 80f31aef7..d7683a045 100755 --- a/src/etc/rc.reboot +++ b/src/etc/rc.reboot @@ -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