#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
##  rc.tsmc -- Run-Commands for TSMC
##

%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

