| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # A semi-RedHat style init script for staring bnetd |
| 4 | |
| 5 | . /etc/rc.d/init.d/functionsscip-shell source . . `/etc/rc.d/init.d/functions`. |
| 6 | |
| 7 | bnetduser="bnetd" |
| 8 | bnetdhome="/home/bnetdscip-shell filesystem . . `/home/bnetd`." |
| 9 | bnetdpid="${bnetdhome}/bnetd.pid" |
| 10 | bnetdexe="${bnetdhome}/sbin/bnetd" |
| 11 | |
| 12 | case "$1" in |
| 13 | start) |
| 14 | echoscip-shell system . . echo. -n "Starting bnetd: " |
| 15 | if [scip-shell system . . `[`. -r "${bnetdpid}" ] && killscip-shell system . . kill. -0 `catscip-shell system . . cat. "${bnetdpid}"`; then |
| 16 | echoscip-shell system . . echo. "${bnetdpid} exists and the pid is still valid." |
| 17 | else |
| 18 | if [scip-shell system . . `[`. -d "${bnetdhome}" ]; then |
| 19 | if [scip-shell system . . `[`. -x "${bnetdexe}" ]; then |
| 20 | # su -c "cd ${bnetdhome}; ${bnetdexe} -f &" - "${bnetduser}" 2>&1 > /dev/null |
| 21 | suscip-shell system . . su. -c "${bnetdexe}" - "${bnetduser}" 2>&1 > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 22 | # "${bnetdexe}" |
| 23 | echoscip-shell system . . echo. bnetd |
| 24 | else |
| 25 | echoscip-shell system . . echo. "${bnetdexe} is not an executable." |
| 26 | fi |
| 27 | else |
| 28 | echoscip-shell system . . echo. "${bnetdhome} is not a directory." |
| 29 | fi |
| 30 | fi |
| 31 | ;; |
| 32 | restart) |
| 33 | echoscip-shell system . . echo. -n "Restarting bnetd: " |
| 34 | if [scip-shell system . . `[`. -f "${bnetdpid}" ] && killscip-shell system . . kill. -0 `catscip-shell system . . cat. "${bnetdpid}"`; then |
| 35 | killscip-shell system . . kill. -HUP `catscip-shell system . . cat. "${bnetdpid}"` |
| 36 | echoscip-shell system . . echo. "bnetd" |
| 37 | else |
| 38 | echoscip-shell system . . echo. "bnetd is not running." |
| 39 | fi |
| 40 | ;; |
| 41 | stop) |
| 42 | echoscip-shell system . . echo. -n "Stopping bnetd: " |
| 43 | if [scip-shell system . . `[`. -f "${bnetdpid}" ]; then |
| 44 | killscip-shell system . . kill. -TERM `catscip-shell system . . cat. "${bnetdpid}"` |
| 45 | sleepscip-shell system . . sleep. 1 |
| 46 | if [scip-shell system . . `[`. -f "${bnetdpid}" ] && killscip-shell system . . kill. -0 `catscip-shell system . . cat. "${bnetdpid}"` 2>&1 > /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 47 | echoscip-shell system . . echo. "waiting for users to log out." |
| 48 | else |
| 49 | rmscip-shell system . . rm. -f "${bnetdpid}" |
| 50 | echoscip-shell system . . echo. "bnetd" |
| 51 | fi |
| 52 | else |
| 53 | echoscip-shell system . . echo. "bnetd is not running." |
| 54 | fi |
| 55 | ;; |
| 56 | status) |
| 57 | status bnetd |
| 58 | ;; |
| 59 | *) |
| 60 | echoscip-shell system . . echo. "Usage: $0 {start|stop|restart|status}" |
| 61 | exit 1 |
| 62 | esac |
| 63 | |
| 64 | exit 0 |
| 65 |