File: S98bnetd

package info (click to toggle)
bnetd 0.4.25-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,516 kB
  • ctags: 7,224
  • sloc: ansic: 67,547; sh: 3,142; makefile: 796; python: 304; perl: 211; awk: 73
file content (65 lines) | stat: -rwxr-xr-x 1,364 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh

# A semi-RedHat style init script for staring bnetd

. /etc/rc.d/init.d/functions

bnetduser="bnetd"
bnetdhome="/home/bnetd"
bnetdpid="${bnetdhome}/bnetd.pid"
bnetdexe="${bnetdhome}/sbin/bnetd"

case "$1" in
  start)
	echo -n "Starting bnetd: "
	if [ -r "${bnetdpid}" ] && kill -0 `cat "${bnetdpid}"`; then
		echo "${bnetdpid} exists and the pid is still valid."
	else
		if [ -d "${bnetdhome}" ]; then
			if [ -x "${bnetdexe}" ]; then
#				su -c "cd ${bnetdhome}; ${bnetdexe} -f &" - "${bnetduser}" 2>&1 > /dev/null
				su -c "${bnetdexe}" - "${bnetduser}" 2>&1 > /dev/null
#				"${bnetdexe}"
				echo bnetd
			else
				echo "${bnetdexe} is not an executable."
			fi
		else
			echo "${bnetdhome} is not a directory."
		fi
	fi
	;;
  restart)
	echo -n "Restarting bnetd: "
	if [ -f "${bnetdpid}" ] && kill -0 `cat "${bnetdpid}"`; then
		kill -HUP `cat "${bnetdpid}"`
		echo "bnetd"
	else
		echo "bnetd is not running."
	fi
	;;
  stop)
	echo -n "Stopping bnetd: "
	if [ -f "${bnetdpid}" ]; then
		kill -TERM `cat "${bnetdpid}"`
		sleep 1
		if [ -f "${bnetdpid}" ] && kill -0 `cat "${bnetdpid}"` 2>&1 > /dev/null; then
			echo "waiting for users to log out."
		else
			rm -f "${bnetdpid}" 
			echo "bnetd"
		fi
	else
		echo "bnetd is not running."
	fi
	;;
  status)
	status bnetd
	;;
  *)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit 0