File: init.linux

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 (86 lines) | stat: -rw-r--r-- 1,937 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
#
# -- START --
# init.linux.sh
#
# lpd           This shell script takes care of starting and stopping
#               lpd (printer daemon).
#  Taken from the RedHat Linux 6.2 distribution for the lpd startup
#  modified to make things a little more robust
#
# 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: lpd
# config: /etc/printcap

# replace this with the path you installed LPRng's lpd.
LPD_PATH=/usr/sbin/lpd

# Source function library.
if [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
fi

# Source networking configuration.
if [ -f /etc/sysconfig/network ] ; then
. /etc/sysconfig/network
fi

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -f "$LPD_PATH" ] || exit 0
[ -f /etc/printcap ] || exit 0

RETVAL=0


# ignore INT signal
trap '' 2

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting lpd: "
        if [ -f /etc/redhat-release ] ; then
            daemon $LPD_PATH
            RETVAL=$?
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lprng
        else
            $LPD_PATH
            RETVAL=$?
        fi
        echo
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down lprng: "
        if [ -f /etc/redhat-release ] ; then
            killproc lpd
            RETVAL=$?
            [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/lprng
        else
            kill -INT `ps ax | awk '/lpd/{ print $1;}'` >/dev/null 2>&1
            RETVAL=0
		fi
        echo
        ;;
  status)
    if [ -f /etc/redhat-release ] ; then
        status lpd
    else
        lpc lpd
    fi
    RETVAL=$?
    ;;
  restart|reload)
    $0 stop
    $0 start
    RETVAL=$?
    ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL