Browse Source

add scheduler start/stop support

Ralf S. Engelschall 24 years ago
parent
commit
d81e7e38f6
1 changed files with 12 additions and 0 deletions
  1. 12 0
      tsmc/rc.tsmc

+ 12 - 0
tsmc/rc.tsmc

@@ -6,9 +6,21 @@
 %config
     tsmc_enable="yes"
 
+%common
+    tsmc_pidfile="@l_prefix@/var/tsmc/dsmc.sched.pid"
+
 %start -p 200 -u root
     opServiceEnabled tsmc || exit 0
+    ( PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
+      nohup @l_prefix@/bin/dsmc sched </dev/null >/dev/null 2>&1 &
+      echo "$!" >$tsmc_pidfile
+    ) </dev/null >/dev/null 2>&1
 
 %stop -p 200 -u root
     opServiceEnabled tsmc || exit 0
+    if [ -f $tsmc_pidfile ]; then
+        kill -TERM `cat $tsmc_pidfile` >/dev/null 2>&1 || true
+        sleep 2
+        kill -KILL `cat $tsmc_pidfile` >/dev/null 2>&1 || true
+    fi