freeswitch-stable: init script update
authorSebastian Kemper <sebastian_ml@gmx.net>
Fri, 22 Dec 2017 21:37:19 +0000 (22:37 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Fri, 22 Dec 2017 21:37:22 +0000 (22:37 +0100)
- Use "-nc -nf" always. When started by procd freeswitch detects the
  console to be orphaned and disables it. So disable the interactive
  console but force freeswitch to not fork into background.
- Improve readability of command parameters.
- Minor changes.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/freeswitch-stable/Makefile
net/freeswitch-stable/files/freeswitch.default
net/freeswitch-stable/files/freeswitch.init

index ce7622aaf6b69d932c1671cb0fb0de60ca780a25..e094a1f38c65addc4c502184c32f5e2d55f379a8 100644 (file)
@@ -376,10 +376,6 @@ $(call Package/$(PKG_NAME)/install/lib,$(1),lib$(PRG_NAME))
                $(1)$(FS_STABLE_SYSCONF_DIR)/init.d/$(PRG_NAME)
        $(INSTALL_CONF) ./files/$(PRG_NAME).default \
                $(1)$(FS_STABLE_SYSCONF_DIR)/default/$(PRG_NAME)
-ifeq ($(CONFIG_FS_STABLE_WITH_LIBEDIT),)
-       $(SED) '/^  #procd_append_param command -nc -nf$$$$/s/#//' \
-                       $(1)$(FS_STABLE_SYSCONF_DIR)/init.d/$(PRG_NAME)
-endif
 endef
 
 define Package/$(PKG_NAME)/postinst
index 32effa2606a548fd9a522ebc477a50505c0f11f6..3d6e911068243641cdbdf445214c8fde8e7d2e3a 100644 (file)
@@ -16,8 +16,8 @@
 #FS_DIR_STORAGE="/tmp/freeswitch/storage"
 #FS_DIR_TEMP="/tmp/freeswitch/temp"
 
-# The following is appended to the command line when starting FreeSWITCH:
-OPTIONS="-np -nonat"
+# The following is added to the command line when starting FreeSWITCH:
+OPTIONS="-nonat -np"
 
 ### Hotplug configuration ###
 
index d55f81067813232d4e791773cace1ff67eaf8dae..6b349b1a00877b80a2c31145d03e2b30ec06d604 100644 (file)
@@ -11,6 +11,7 @@ FS=freeswitch
 DEFAULT=/etc/default/$FS
 LOGGER="/usr/bin/logger -p user.err -s -t $FS"
 OPTIONS=
+PROG=/usr/bin/$FS
 TIMEOUT=30
 
 [ -f $DEFAULT ] && . $DEFAULT
@@ -56,20 +57,23 @@ start_service() {
 
   procd_open_instance
   # starting with full path seems cleaner judging by 'ps' output
-  procd_set_param command /usr/bin/$FS
+  procd_set_param command $PROG
   # need to specify all or none of -conf, -log, and -db
-  procd_append_param command -cache "$fs_dir_cache" -conf \
-    "$fs_dir_etc" -db "$fs_dir_db" -log "$fs_dir_log" -recordings \
-    "$fs_dir_recordings" -run "$fs_dir_run" -storage "$fs_dir_storage" \
-    -temp "$fs_dir_temp"
-  procd_append_param command -c
-  # -nc -nf: workaround for interop issue (which causes high load)
-  #procd_append_param command -nc -nf
-  procd_append_param command $OPTIONS
-  procd_set_param user "$fs_user"
-  # forward stdout of the command to logd
-  #procd_set_param stdout 1
-  # same for stderr
+  procd_append_param command \
+    -cache "$fs_dir_cache" \
+    -conf "$fs_dir_etc" \
+    -db "$fs_dir_db" \
+    -g "$fs_group" \
+    -log "$fs_dir_log" \
+    -recordings "$fs_dir_recordings" \
+    -run "$fs_dir_run" \
+    -storage "$fs_dir_storage" \
+    -temp "$fs_dir_temp" \
+    -u "$fs_user" \
+    $OPTIONS \
+    -nc \
+    -nf
+  # forward stderr to logd
   procd_set_param stderr 1
   procd_close_instance
 }
@@ -107,7 +111,7 @@ stop_service() {
   }
 
   timeout=$TIMEOUT
-  kill $mypid
+  kill $mypid 2>/dev/null
   pgrep $FS | grep -w $mypid &>/dev/null
   retval=$?