Project

General

Profile

« Previous | Next » 

Revision 2156f02a

Added by Jim Pingle over 13 years ago

Only run if this is an array

View differences:

etc/rc.carpbackup
41 41

  
42 42
/* Stop OpenVPN clients running on this VIP, since multiple active OpenVPN clients on a CARP cluster can be problematic. */
43 43
global $config;
44
foreach ($config['openvpn']['openvpn-client'] as $settings) {
45
	if ($settings['interface'] == $argv[1]) {
46
		log_error("Stopping OpenVPN instance on {$settings['interface']} because of transition to CARP backup.");
47
		openvpn_restart('client', $settings);
44
if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) {
45
	foreach ($config['openvpn']['openvpn-client'] as $settings) {
46
		if ($settings['interface'] == $argv[1]) {
47
			log_error("Stopping OpenVPN instance on {$settings['interface']} because of transition to CARP backup.");
48
			openvpn_restart('client', $settings);
49
		}
48 50
	}
49 51
}
50 52

  
53

  
51 54
?>
etc/rc.carpmaster
41 41

  
42 42
/* Start OpenVPN clients running on this VIP, since they should be in the stopped state while the VIP is CARP Backup. */
43 43
global $config;
44
foreach ($config['openvpn']['openvpn-client'] as $settings) {
45
	if ($settings['interface'] == $argv[1]) {
46
		log_error("Starting OpenVPN instance on {$settings['interface']} because of transition to CARP master.");
47
		openvpn_restart('client', $settings);
44
if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) {
45
	foreach ($config['openvpn']['openvpn-client'] as $settings) {
46
		if ($settings['interface'] == $argv[1]) {
47
			log_error("Starting OpenVPN instance on {$settings['interface']} because of transition to CARP master.");
48
			openvpn_restart('client', $settings);
49
		}
48 50
	}
49 51
}
50 52

  

Also available in: Unified diff