Commit b0dac383 authored by Franco Fichtner's avatar Franco Fichtner

inc|rc: shuffle more things due to shutdown flow cleanups

parent 338f71c2
...@@ -1621,8 +1621,6 @@ function system_ntp_configure($start_ntpd = true) ...@@ -1621,8 +1621,6 @@ function system_ntp_configure($start_ntpd = true)
function system_halt($sync = false) function system_halt($sync = false)
{ {
system_reboot_cleanup();
$cmd ='/usr/local/etc/rc.halt > /dev/null 2>&1'; $cmd ='/usr/local/etc/rc.halt > /dev/null 2>&1';
if (!$sync) { if (!$sync) {
...@@ -1634,8 +1632,6 @@ function system_halt($sync = false) ...@@ -1634,8 +1632,6 @@ function system_halt($sync = false)
function system_reboot($sync = false) function system_reboot($sync = false)
{ {
system_reboot_cleanup();
$cmd ='/usr/local/etc/rc.reboot > /dev/null 2>&1'; $cmd ='/usr/local/etc/rc.reboot > /dev/null 2>&1';
if (!$sync) { if (!$sync) {
...@@ -1645,19 +1641,6 @@ function system_reboot($sync = false) ...@@ -1645,19 +1641,6 @@ function system_reboot($sync = false)
mwexec($cmd); mwexec($cmd);
} }
function system_reboot_cleanup()
{
global $config, $cpzone;
require_once("captiveportal.inc");
if (is_array($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpzone=>$cp) {
captiveportal_radius_stop_all();
captiveportal_send_server_accounting(true);
}
}
}
function system_console_configure() function system_console_configure()
{ {
setup_serial_port(); setup_serial_port();
......
...@@ -98,12 +98,13 @@ function voucher_expire($voucher_received) { ...@@ -98,12 +98,13 @@ function voucher_expire($voucher_received) {
// Refresh active DBs // Refresh active DBs
if ($active_dirty == true) { if ($active_dirty == true) {
foreach ($active_vouchers as $roll => $active) foreach ($active_vouchers as $roll => $active) {
voucher_write_active_db($roll, $active); voucher_write_active_db($roll, $active);
}
unset($active_vouchers); unset($active_vouchers);
/* Triger a sync of the vouchers on config */ /* trigger a sync of the vouchers on config */
send_event("service sync vouchers"); voucher_save_db_to_config();
} }
// Write back the used DB's // Write back the used DB's
...@@ -263,9 +264,8 @@ function voucher_auth($voucher_received, $test = 0) { ...@@ -263,9 +264,8 @@ function voucher_auth($voucher_received, $test = 0) {
$active_vouchers[$first_voucher_roll][$first_voucher] = "$timestamp,$minutes"; $active_vouchers[$first_voucher_roll][$first_voucher] = "$timestamp,$minutes";
voucher_write_active_db($first_voucher_roll, $active_vouchers[$first_voucher_roll]); voucher_write_active_db($first_voucher_roll, $active_vouchers[$first_voucher_roll]);
/* Triger a sync of the vouchers on config */ /* trigger a sync of the vouchers on config */
send_event("service sync vouchers"); voucher_save_db_to_config();
return $total_minutes; return $total_minutes;
} }
...@@ -393,11 +393,11 @@ function voucher_read_active_db($roll) { ...@@ -393,11 +393,11 @@ function voucher_read_active_db($roll) {
} }
} }
fclose($fd); fclose($fd);
if ($dirty) { // if we found expired entries, lets save our snapshot if ($dirty) {
/* if we found expired entries, lets save our snapshot */
voucher_write_active_db($roll, $active); voucher_write_active_db($roll, $active);
/* trigger a sync of the vouchers on config */
/* Triger a sync of the vouchers on config */ voucher_save_db_to_config();
send_event("service sync vouchers");
} }
} }
} }
......
...@@ -34,4 +34,13 @@ require_once("shaper.inc"); ...@@ -34,4 +34,13 @@ require_once("shaper.inc");
require_once("captiveportal.inc"); require_once("captiveportal.inc");
require_once("voucher.inc"); require_once("voucher.inc");
global $config, $cpzone;
if (isset($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpzone => $cp) {
captiveportal_radius_stop_all();
captiveportal_send_server_accounting(true);
}
}
voucher_save_db_to_config(); voucher_save_db_to_config();
#!/bin/sh #!/bin/sh
# run beep sequence if enabled
/usr/local/bin/beep.sh stop
# shutdown rc scripts # shutdown rc scripts
/usr/local/etc/rc.opnsense stop /usr/local/etc/rc.opnsense stop
# backup volatile internals # backup volatile internals
/usr/local/etc/rc.backup_rrd /usr/local/etc/rc.backup_captiveportal
/usr/local/etc/rc.backup_dhcpleases /usr/local/etc/rc.backup_dhcpleases
/usr/local/etc/rc.savevouchers /usr/local/etc/rc.backup_rrd
# wait for config lock to release # wait for config lock to release
php -a >/dev/null << EOF php -a >/dev/null << EOF
...@@ -16,6 +19,3 @@ if (flock(\$fp, LOCK_EX)) { ...@@ -16,6 +19,3 @@ if (flock(\$fp, LOCK_EX)) {
fclose(\$fp); fclose(\$fp);
} }
EOF EOF
# run beep sequence if enabled
/usr/local/bin/beep.sh stop
...@@ -57,9 +57,3 @@ command:/usr/local/etc/rc.restart_webgui ...@@ -57,9 +57,3 @@ command:/usr/local/etc/rc.restart_webgui
parameters: parameters:
type:script type:script
message:webConfigurator restart in progress message:webConfigurator restart in progress
[sync.vouchers]
command:/usr/local/etc/rc.savevoucher
parameters:
type:script
message:Synching vouchers
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment