Debian Codegraph @

contrib/dist/rpm/proftpd.init.d

raw
1 #!/bin/sh
2 #
3 # Startup script for ProFTPD
4 #
5 # chkconfig: - 85 15
6 # description: ProFTPD is an enhanced FTP server with a focus towards \
7 # simplicity, security, and ease of configuration. \
8 # It features a very Apache-like configuration syntax, \
9 # and a highly customizable server infrastructure, \
10 # including support for multiple 'virtual' FTP servers, \
11 # anonymous FTP, and permission-based directory visibility.
12 # processname: proftpd
13 # config: /etc/proftpd.conf
14 # pidfile: /var/run/proftpd/proftpd.pid
15
16 ### BEGIN INIT INFO
17 # Provides: proftpd ftpserver
18 # Required-Start: $local_fs $network $named $remote_fs
19 # Required-Stop: $local_fs $network $named $remote_fs
20 # Default-Stop: 0 1 6
21 # Short-Description: ProFTPd FTP Server
22 # Description: ProFTPd is an enhanced FTP server with a focus towards
23 # simplicity, security, and ease of configuration.
24 # It features a very Apache-like configuration syntax,
25 # and a highly customizable server infrastructure,
26 # including support for multiple 'virtual' FTP servers,
27 # anonymous FTP, and permission-based directory visibility.
28 ### END INIT INFO
29
30 # Source function library.
31 . /etc/rc.d/init.d/functions
32
33 # Source networking configuration.
34 . /etc/sysconfig/network
35
36 # Source ProFTPD configuration.
37 PROFTPD_OPTIONS=""
38 if [ -f /etc/sysconfig/proftpd ]; then
39 . /etc/sysconfig/proftpd
40 fi
41
42 # Check that networking is enabled.
43 [ ${NETWORKING} = "no" ] && exit 1
44
45 # Make sure the binary is present.
46 [ -x /usr/sbin/proftpd ] || exit 5
47
48 RETVAL=0
49 prog="proftpd"
50
51 start() {
52 echo -n $"Starting $prog: "
53 daemon proftpd $PROFTPD_OPTIONS 2>/dev/null
54 RETVAL=$?
55 echo
56 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
57 }
58
59 stop() {
60 echo -n $"Shutting down $prog: "
61 killproc proftpd
62 RETVAL=$?
63 echo
64 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
65 }
66
67 # See how we were called.
68 case "$1" in
69 start)
70 start
71 ;;
72 stop)
73 stop
74 ;;
75 status)
76 status proftpd
77 RETVAL=$?
78 ;;
79 restart)
80 stop
81 start
82 ;;
83 try-restart|condrestart)
84 if [ -f /var/lock/subsys/proftpd ]; then
85 stop
86 start
87 fi
88 ;;
89 reload|force-reload|reread)
90 echo -n $"Re-reading $prog configuration: "
91 killproc proftpd -HUP
92 RETVAL=$?
93 echo
94 ;;
95 configtest)
96 echo -n $"Testing $prog configuration: "
97 proftpd -n -t
98 RETVAL=$?
99 echo
100 ;;
101 suspend)
102 hash ftpshut >/dev/null 2>&1
103 if [ $? = 0 ]; then
104 if [ $# -gt 1 ]; then
105 shift
106 echo -n "Suspending with '$*'"
107 ftpshut "$@"
108 RETVAL=$?
109 else
110 echo -n "Suspending NOW"
111 ftpshut now "Maintenance in progress"
112 RETVAL=$?
113 fi
114 else
115 echo -n "No way to suspend"
116 RETVAL=1
117 fi
118 echo
119 ;;
120 resume)
121 if [ -f /etc/shutmsg ]; then
122 echo -n "Allowing sessions again"
123 rm -f /etc/shutmsg
124 else
125 echo -n "Was not suspended"
126 RETVAL=2
127 fi
128 echo
129 ;;
130 *)
131 echo -n "Usage: $prog {start|stop|restart|try-restart|reload|status|reread|resume"
132 hash ftpshut
133 if [ $? = 1 ]; then
134 echo '}'
135 else
136 echo '|suspend}'
137 echo 'suspend accepts additional arguments, which are passed to ftpshut(8)'
138 fi
139 exit 2
140 esac
141
142 exit $RETVAL