155,6 → 155,18 |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); |
if ($service == "sshd"){ |
if ($action == "start"){ |
//exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service)); |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); // in order to keep that conf for SSH at next reboot |
exec("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
if ($action == "stop"){ |
//exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service)); |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE))); |
exec("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
} |
return $retstatus; |
} else { |
return false; |