86,15 → 86,15 |
//fonction pour faire une action (start,stop,restart) sur un service |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
exec("sudo /sbin/service $service $action",$retval, $retstatus); |
exec("sudo /bin/systemctl $action $service",$retval, $retstatus); |
if ($service == "sshd"){ |
if ($action == "start"){ |
exec("sudo /bin/systemctl enable $service.service"); |
exec("sudo /bin/systemctl enable $service"); |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
if ($action == "stop"){ |
exec("sudo /sbin/systemctl disable $service.service"); |
exec("sudo /sbin/systemctl disable $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"); |
} |