aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-11-13 22:16:29 +0100
committerdoktornotor <notordoktor@gmail.com>2015-11-13 22:16:29 +0100
commit65bc655129912c6d9c213a50c86d5d199a6474b6 (patch)
treeea7387ef25f626a7b8b24376da633ccf70452a71
parent59e50aa2c34f50c60dc517bde1b1a8d8e9fb19e2 (diff)
downloadpfsense-packages-65bc655129912c6d9c213a50c86d5d199a6474b6.tar.gz
pfsense-packages-65bc655129912c6d9c213a50c86d5d199a6474b6.tar.bz2
pfsense-packages-65bc655129912c6d9c213a50c86d5d199a6474b6.zip
Improve service handling, code style cleanups
-rw-r--r--config/ladvd/ladvd.inc23
1 files changed, 17 insertions, 6 deletions
diff --git a/config/ladvd/ladvd.inc b/config/ladvd/ladvd.inc
index da37a1a9..c1d769ab 100644
--- a/config/ladvd/ladvd.inc
+++ b/config/ladvd/ladvd.inc
@@ -36,18 +36,24 @@ require_once("pkg-utils.inc");
function ladvd_resync_config() {
global $config;
- conf_mount_rw();
-
- if (!is_array($config['installedpackages']['ladvd']))
+ if (!is_array($config['installedpackages']['ladvd'])) {
return;
- if (!is_array($config['installedpackages']['ladvd']['config']))
+ }
+ if (!is_array($config['installedpackages']['ladvd']['config'])) {
return;
+ }
$ladvd_conf = &$config['installedpackages']['ladvd']['config'][0];
+ conf_mount_rw();
/* ladvd is turned off in package settings */
- if (empty($ladvd_conf['enable']))
+ if (empty($ladvd_conf['enable'])) {
+ if (is_service_running("ladvd")) {
+ stop_service("ladvd");
+ }
+ unlink_if_exists("/usr/local/etc/rc.d/ladvd.sh");
return;
+ }
$cmdline = "";
@@ -98,7 +104,12 @@ function ladvd_resync_config() {
)
);
- restart_service("ladvd");
+ if (is_service_running("ladvd")) {
+ restart_service("ladvd");
+ } else {
+ start_service("ladvd");
+ }
+
sleep(1);
conf_mount_ro();
}