From 6f41b37996add7ec9179ccf4e45c5237697015c0 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 6 Feb 2013 22:16:12 +0100 Subject: [PATCH] When init starts daemons through a shell script, replace the shell altogether A few daemons are being started from init through a shell script. Since the daemon does not "deamonizes" properly, it's been put in the background from the shell by using ( ... ) &, however this leaves a lingering shell that serves no purpose. This patch improves this situation. The situation before this change looked like: init-+-Xorg |-avahi-daemon |-console-kit-dae-+-62*[{console-kit-da}] | `-{gdbus} |-dbus-daemon |-eventlircd |-klogd : |-init---atvclient |-init---connmand : |-init---ratpoison : |-init---udevadm |-polkitd---{gdbus} |-rpcbind |-sshd---sshd---sh---pstree |-syslogd |-systemd-udevd : |-tvheadend.start---tvheadend---12*[{tvheadend}] |-udisks-daemon-+-udisks-daemon | |-{gdbus} | `-{gmain} |-upowerd-+-{gdbus} | `-{gmain} |-wpa_supplicant `-xbmc.bin---17*[{xbmc.bin}] After this change, it looks like: init-+-Xorg : |-atvclient |-avahi-daemon |-console-kit-dae-+-62*[{console-kit-da}] | `-{gdbus} |-dbus-daemon |-eventlircd |-init---connmand |-klogd |-polkitd---{gdbus} : |-ratpoison |-rpcbind |-sshd---sshd---sh---pstree |-syslogd |-systemd-udevd : |-tvheadend---12*[{tvheadend}] : |-udevadm |-udisks-daemon-+-udisks-daemon | |-{gdbus} | `-{gmain} |-upowerd-+-{gdbus} | `-{gmain} |-wpa_supplicant `-xbmc.bin---17*[{xbmc.bin}] Only for connmand this is not easily done since the shell loops and restarts connmand. In different circumstances /etc/inittab would respawn the process. --- .../service/multimedia/tvheadend/source/bin/tvheadend.start | 4 ++-- packages/sysutils/remote/atvclient/init.d/63_atvclient | 4 ++-- packages/sysutils/systemd/init.d/12_udev-monitor | 2 +- packages/x11/other/ratpoison/init.d/73_ratpoison | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/addons/service/multimedia/tvheadend/source/bin/tvheadend.start b/packages/addons/service/multimedia/tvheadend/source/bin/tvheadend.start index d39b22dc8f..3fa1dbfec5 100755 --- a/packages/addons/service/multimedia/tvheadend/source/bin/tvheadend.start +++ b/packages/addons/service/multimedia/tvheadend/source/bin/tvheadend.start @@ -134,9 +134,9 @@ mkdir -p $ADDON_HOME fi if [ "$PRELOAD_CAPMT_CA" == "true" ] ; then logger -t Tvheadend "### Preloading capmt_ca.so library ###" - LD_PRELOAD=$ADDON_DIR/bin/capmt_ca.so $ADDON_BIN $TVHEADEND_ARG &>$LOG_FILE + LD_PRELOAD=$ADDON_DIR/bin/capmt_ca.so exec $ADDON_BIN $TVHEADEND_ARG &>$LOG_FILE else - $ADDON_BIN $TVHEADEND_ARG &>$LOG_FILE + exec $ADDON_BIN $TVHEADEND_ARG &>$LOG_FILE fi done & fi diff --git a/packages/sysutils/remote/atvclient/init.d/63_atvclient b/packages/sysutils/remote/atvclient/init.d/63_atvclient index 38d772f563..07f22742e2 100644 --- a/packages/sysutils/remote/atvclient/init.d/63_atvclient +++ b/packages/sysutils/remote/atvclient/init.d/63_atvclient @@ -24,6 +24,6 @@ ( progress "starting ATVclient" - mkdir -p /storage/.cache - atvclient -m > /dev/null 2>&1 + mkdir -p /storage/.cache + exec atvclient -m > /dev/null 2>&1 )& \ No newline at end of file diff --git a/packages/sysutils/systemd/init.d/12_udev-monitor b/packages/sysutils/systemd/init.d/12_udev-monitor index f380489255..77d3d77b0b 100644 --- a/packages/sysutils/systemd/init.d/12_udev-monitor +++ b/packages/sysutils/systemd/init.d/12_udev-monitor @@ -25,5 +25,5 @@ ( progress "monitoring udev events" - udevadm monitor -e > /dev/udev.log + exec udevadm monitor -e > /dev/udev.log )& diff --git a/packages/x11/other/ratpoison/init.d/73_ratpoison b/packages/x11/other/ratpoison/init.d/73_ratpoison index c4846ace6e..7954754d97 100644 --- a/packages/x11/other/ratpoison/init.d/73_ratpoison +++ b/packages/x11/other/ratpoison/init.d/73_ratpoison @@ -30,8 +30,8 @@ # starting ratpoison if [ -f /storage/.config/ratpoisonrc ]; then - DISPLAY=:0.0 ratpoison -f /storage/.config/ratpoisonrc > /dev/null 2>&1 + exec ratpoison -f /storage/.config/ratpoisonrc -d :0.0 > /dev/null 2>&1 else - DISPLAY=:0.0 ratpoison > /dev/null 2>&1 + exec ratpoison -d :0.0 > /dev/null 2>&1 fi )&