Project

General

Profile

« Previous | Next » 

Revision 920af30f

Added by Ermal Luçi over 15 years ago

Do propper checking on sasyncd to not try to start this damon uselessly.

View differences:

etc/inc/vpn.inc
46 46
function vpn_ipsec_failover_configure() {
47 47
	global $config, $g;
48 48

  
49
	$sasyncd_text = "";
50 49

  
51
	if ($config['installedpackages']['sasyncd'] <> "")
50
	if (is_array($config['installedpackages']['sasyncd'])) {
51
		$sasyncd_text = "";
52 52
		foreach ($config['installedpackages']['sasyncd']['config'] as $sasyncd) {
53 53
			$enabled = isset ($sasyncd['enable']);
54 54
			if (!$enabled)
......
67 67
				$sasyncd_text .= "flushmode sync {$sasyncd['flushmodesync']}\n";
68 68
		}
69 69

  
70
	$fd = fopen("{$g['varetc_path']}/sasyncd.conf", "w");
71
	fwrite($fd, $sasyncd_text);
72
	fclose($fd);
73
	chmod("{$g['varetc_path']}/sasyncd.conf", 0600);
70
		file_put_contents("{$g['varetc_path']}/sasyncd.conf", $sasyncd_text);
71
		chmod("{$g['varetc_path']}/sasyncd.conf", 0600);
74 72

  
75
	if(is_process_running("sasyncd"))
76
		mwexec("killall sasyncd", true);
73
		if(is_process_running("sasyncd"))
74
			mwexec("killall sasyncd", true);
77 75

  
78
	/* launch sasyncd, oh wise one */
79
	mwexec_bg("/usr/local/sbin/sasyncd -d -v -v -v");
76
		/* launch sasyncd, oh wise one */
77
		mwexec_bg("/usr/local/sbin/sasyncd -d -v -v -v");
78
	}
80 79
}
81 80

  
82 81
function find_last_gif_device() {

Also available in: Unified diff