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