Subversion Repositories ALCASAR

Rev

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

Rev 434 Rev 595
Line 77... Line 77...
77
*********************************************************************/
77
*********************************************************************/
78
 
78
 
79
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
79
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
80
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0");
80
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0");
81
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
81
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
82
 
-
 
-
 
82
define ("ALCASAR_NETWORK", "/usr/local/etc/alcasar-network");
83
/********************************************************************
83
/********************************************************************
84
*				TEST DES FICHIERS DE CONFIGURATION					*
84
*				TEST DES FICHIERS DE CONFIGURATION					*
85
*********************************************************************/
85
*********************************************************************/
86
 
86
 
87
//Test de présence et des droits en lecture des fichiers de configuration.
87
//Test de présence et des droits en lecture des fichiers de configuration.
Line 104... Line 104...
104
//fonction pour faire une action (start,stop,restart) sur un service
104
//fonction pour faire une action (start,stop,restart) sur un service
105
function serviceExec($service, $action){
105
function serviceExec($service, $action){
106
	if (($action == "start")||($action == "stop")||($action == "restart")){
106
	if (($action == "start")||($action == "stop")||($action == "restart")){
107
		exec("sudo /sbin/service $service $action",$retval, $retstatus);
107
		exec("sudo /sbin/service $service $action",$retval, $retstatus);
108
		if ($service == "sshd"){
108
		if ($service == "sshd"){
-
 
109
			if ($action == "start"){ 
109
			if ($action == "start"){ exec("sudo /sbin/chkconfig --add $service");}
110
				exec("sudo /sbin/chkconfig --add $service");
-
 
111
				file_put_contents(ALCASAR_NETWORK, str_replace('SSH=off', 'SSH=on', file_get_contents(ALCASAR_NETWORK)));
-
 
112
				}
-
 
113
			if ($action == "stop"){
110
			if ($action == "stop"){ exec("sudo /sbin/chkconfig --del $service");}
114
			       	exec("sudo /sbin/chkconfig --del $service");
-
 
115
				file_put_contents(ALCASAR_NETWORK, str_replace('SSH=on', 'SSH=off', file_get_contents(ALCASAR_NETWORK)));
-
 
116
				}
111
			}
117
			}
112
		return $retstatus;
118
		return $retstatus;
113
	} else {
119
	} else {
114
		return false;
120
		return false;
115
	}
121
	}