new dtlogin rc script for linux from David McBrayer <d9j0m.dev@gmail.com>
authorJon Trulson <jon@radscan.com>
Thu, 16 Aug 2012 23:05:38 +0000 (17:05 -0600)
committerJon Trulson <jon@radscan.com>
Thu, 16 Aug 2012 23:05:38 +0000 (17:05 -0600)
cde/contrib/rc/linux/README.dtlogin [new file with mode: 0644]
cde/contrib/rc/linux/dtlogin [new file with mode: 0644]

diff --git a/cde/contrib/rc/linux/README.dtlogin b/cde/contrib/rc/linux/README.dtlogin
new file mode 100644 (file)
index 0000000..7935855
--- /dev/null
@@ -0,0 +1,19 @@
+I have attached an LSB-compliant init script for dtlogin as an update to
+the current wiki. All instructions currently on the wiki should be left.
+This only replaces the script contents. This allows dtlogin to be
+controlled using either of the following syntax:
+
+/etc/init.d/dtlogin start | stop | restart | status
+service dtlogin start | stop | restart | status
+
+With the old script, dtlogin would be restarted on shutdown which resulted
+in the system hanging. This script allows CDE to be properly shutdown on
+halt or restarts.
+
+If anyone can improve/change/enhance this script, please feel free. This is
+just my attempt at getting a working version so my system doesn't hang.
+Also, note that there is no #!/bin/sh at the start of the file. It is not
+necessary and will cause the script not to work properly.
+
+David McBrayer <d9j0m.dev@gmail.com>
+
diff --git a/cde/contrib/rc/linux/dtlogin b/cde/contrib/rc/linux/dtlogin
new file mode 100644 (file)
index 0000000..71809c4
--- /dev/null
@@ -0,0 +1,58 @@
+### BEGIN INIT INFO
+# Provides:
+# Required-Start:      $all
+# Required-Stop:       
+# Default-Start:       2 3 4 5
+# Default-Stop:                0 1 6
+# Short-Description:   Dtlogin
+# Description:         Dtlogin
+### END INIT INFO
+
+case "$1" in
+       'start')
+               if [ -z "$(pgrep dtlogin)" ];
+               then
+                       echo " * Starting dtlogin..."
+                       export LANG=C
+                       exec /usr/dt/bin/dtlogin
+               else
+                       echo "DTlogin already running..."
+                       exit 0
+               fi
+       ;;
+       'stop')
+               if [ -z "$(pgrep dtlogin)" ];
+               then
+                       exit 0
+               else
+                       echo " * Stopping dtlogin..."
+                       killall /usr/dt/bin/dtlogin
+               fi
+       ;;
+       'restart')
+               if [ -z "$(pgrep dtlogin)" ];
+               then
+                       export LANG=C
+                       exec /usr/dt/bin/dtlogin
+               else
+                       echo " * Restarting dtlogin..."
+                       killall /usr/dt/bin/dtlogin
+                       export LANG=C
+                       exec /usr/dt/bin/dtlogin        
+               fi
+       ;;
+       'status')
+               if [ -z "$(pgrep dtlogin)" ];
+               then
+                       echo "DTlogin is not currently running..."
+                       exit 3
+               else
+                       echo "DTlogin is running..." && echo "[ $(pidof dtlogin) ]"
+                       exit 0
+               fi
+       ;;
+       *)
+               echo "Usage: $0 {start|stop|restart|status}"
+               exit 0
+       ;;
+esac