Mercurial > sm-archive
annotate sm-archive.rc.in @ 27:9298f8b00db2 stable-1-0-10
patches from Takao Abe add switches for config and pid files
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 24 May 2018 10:35:45 -0700 |
parents | 8ebecad6530f |
children |
rev | line source |
---|---|
17
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 #!@BASH@ |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 # |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 # sm-archive This script controls the sm-archive milter daemon. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 # |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 # |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 # chkconfig: 2345 79 31 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 # description: sm-archive allows adding recipients to mail passing thru this milter |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 # processname: sm-archive |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 # pidfile: /var/run/sm-archive.pid |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 # Source function library. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 # |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 . /etc/rc.d/init.d/functions |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 # Source networking configuration. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 . /etc/sysconfig/network |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 RETVAL=0 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 # See how we were called. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 case "$1" in |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 start) |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 # Start daemons. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 echo -n "Starting sm-archive-milter: " |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 if [ ! -f /var/lock/subsys/smarchive ]; then |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 cd SYSCONFDIR/sm-archive # conf file is here |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 SBINDIR/smarchive -d 10 -p local:/var/run/sm-archive/sm-archive.sock |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 RETVAL=$? |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 pid=`pidof -s SBINDIR/smarchive` |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 if [ $pid ] |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 then |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 success "Starting sm-archive milter:" |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 touch /var/lock/subsys/smarchive |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 echo |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 else |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 failure "Starting sm-archive milter:" |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 echo |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 fi |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 else |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 echo -n "already running! " |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 failure "sm-archive milter already running!" |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 echo |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 fi |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 ;; |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 stop) |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 # Stop daemons. |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 echo -n "Shutting down sm-archive-milter: " |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 killproc smarchive |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 RETVAL=$? |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 echo |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smarchive |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 ;; |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 restart|reload) |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 $0 stop |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 $0 start |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 RETVAL=$? |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 ;; |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 status) |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 status smarchive |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 RETVAL=$? |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 ;; |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 *) |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 echo "Usage: sm-archive {start|stop|restart|status}" |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 exit 1 |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 esac |
8ebecad6530f
Add src/daemon* missing from source control.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 exit $RETVAL |