File: init.redhat

package info (click to toggle)
lprng 3.8.B-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,344 kB
  • sloc: ansic: 35,071; sh: 3,040; perl: 1,896; makefile: 380
file content (120 lines) | stat: -rw-r--r-- 2,651 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
#
# lpd           This shell script takes care of starting and stopping \
#               lpd (printer daemon).
#
# chkconfig: 2345 60 60
# description: lpd is the print daemon required for lpr to work properly. \
#       It is basically a server that arbitrates print jobs to printer(s).
# processname: /usr/sbin/lpd
# config: /etc/printcap

# replace with the path you installed LPRng's lpd in:
LPD_PATH=/usr/sbin/lpd
# same with checkpc:
CHECKPC_PATH=/usr/sbin/checkpc

# how to install this (according to the old postinstall.linux from 2001):
# - disable all previous printing systems, e.g.:
#	for n in lpr lpd lprng cupy cups-lpd ; do /sbin/chkconfig $n off ; done
# - update the paths above
# - run checkpc -f manually
#   (and make sure all config files are in place so it succeeds)
# - install this file to /etc/rc.d/init.d/lpd
# - register this file with chkconfig:
#	/sbin/chkconfig --add lpd
#	/sbin/chkconfig --list lpd
#	/sbin/chkconfig lpd on
#	service lpd start

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration and check that networking is up.
if [ -f /etc/sysconfig/network ] ; then
	. /etc/sysconfig/network
	[ "${NETWORKING}" = "no" ] && exit 0
fi

[ -x "$LPD_PATH" ] || exit 0

prog=lpd

RETVAL=0

start () {
    echo -n $"Starting $prog: "
    # Is this a printconf system?
    if [[ -x /usr/sbin/printconf-backend ]]; then
	    # run printconf-backend to rebuild printcap and spools
	    if ! /usr/sbin/printconf-backend ; then
		# If the backend fails, we dont start no printers defined
		echo -n $"No Printers Defined"
		#echo_success
		#echo
	        #return 0
	    fi
    fi
    if ! [ -e /etc/printcap ] ; then
	echo_failure
	echo
	return 1
    fi
    # run checkpc to fix whatever lpd would complain about
    $CHECKPC_PATH -f
    # start daemon
    daemon $LPD_PATH
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/lpd
    return $RETVAL
}

stop () {
    # stop daemon
    echo -n $"Stopping $prog: "
    killproc $LPD_PATH
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/lpd
    return $RETVAL
}

restart () {
    stop
    start
    RETVAL=$?
    return $RETVAL
}

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status $LPD_PATH
	RETVAL=$?
	;;
    restart)
	restart
	;;
    condrestart)
	# only restart if it is already running
	[ -f /var/lock/subsys/lpd ] && restart || :
	;;
    reload)
	echo -n $"Reloading $prog: "
	killproc $LPD_PATH -HUP
	RETVAL=$?
	echo
	;;
    *)
        echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
        RETVAL=1
esac

exit $RETVAL