Subversion Repositories ALCASAR

Rev

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

Rev 1006 Rev 1041
Line 73... Line 73...
73
function serviceExec($service, $action){
73
function serviceExec($service, $action){
74
	if (($action == "start")||($action == "stop")||($action == "restart")){
74
	if (($action == "start")||($action == "stop")||($action == "restart")){
75
		exec("sudo /sbin/service $service $action",$retval, $retstatus);
75
		exec("sudo /sbin/service $service $action",$retval, $retstatus);
76
		if ($service == "sshd"){
76
		if ($service == "sshd"){
77
			if ($action == "start"){ 
77
			if ($action == "start"){ 
78
				exec("sudo /sbin/chkconfig --add $service");
78
				exec("sudo /bin/systemctl enable $service.service");
79
				file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
79
				file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
80
				exec ("sudo /usr/local/bin/alcasar-iptables.sh");
80
				exec ("sudo /usr/local/bin/alcasar-iptables.sh");
81
				}
81
				}
82
			if ($action == "stop"){
82
			if ($action == "stop"){
83
			       	exec("sudo /sbin/chkconfig --del $service");
83
			       	exec("sudo /bin/systemctl disable $service.service");
84
				file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
84
				file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
85
				exec ("sudo /usr/local/bin/alcasar-iptables.sh");
85
				exec ("sudo /usr/local/bin/alcasar-iptables.sh");
86
				}
86
				}
87
			}
87
			}
88
		return $retstatus;
88
		return $retstatus;