Subversion Repositories ALCASAR

Rev

Rev 3028 | Rev 3070 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3028 Rev 3043
Line 153... Line 153...
153
$wifi4eu_code = $conf['WIFI4EU_CODE'];
153
$wifi4eu_code = $conf['WIFI4EU_CODE'];
154
// Doing an action on a service (start,stop or restart)
154
// Doing an action on a service (start,stop or restart)
155
function serviceExec($service, $action){
155
function serviceExec($service, $action){
156
	if (($action == "start")||($action == "stop")||($action == "restart")){
156
	if (($action == "start")||($action == "stop")||($action == "restart")){
157
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
157
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
158
		if ($service == "sshd"){ 
-
 
159
			if ($action == "start"){
-
 
160
				//exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service));
-
 
161
				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
-
 
162
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
-
 
163
				}
-
 
164
			if ($action == "stop"){
-
 
165
				//exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service));
-
 
166
				file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
-
 
167
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
-
 
168
				}
-
 
169
			}
-
 
170
		return $retstatus;
158
		return $retstatus;
171
	} else {
159
	} else {
172
		return false;
160
		return false;
173
	}
161
	}
174
}
162
}