Subversion Repositories configs

Rev

Rev 154 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# Script to run Fetchmail software at boot time.
4
#
5
# Last Updated: 21st October 2003
6
#
7
# This script is based upon the init scripts
8
# as used on Red Hat Linux.
9
#
10
# The script has been tested on RH 7.x, 8.0, and 9.0
11
#
12
# Author: Gary Myers  AMBCS
13
# mailto: gary@xxxxxxxxxxxxxx
14
#
15
# This script is realeased under the terms of the GPL.
16
# You can source a copy at:
17
# http://www.fsf.org/copyleft/copyleft.html
18
#====================================================================
19
# Change history:
20
 
21
#
22
# sometime 2004: Modified for my liking ;)
23
#
24
 
25
# 21st October 2003: Michael Thompson added `-f $FRC' to Start
26
# section to stop the boot process from complaining about no
27
# mailservers being specified.
28
 
29
# 3rd November 2003: Corrected Run level info line.
30
 
31
#====================================================================
32
 
33
#====================================================================
34
# Run level information
35
#
36
# chkconfig: 2345 99 90
37
# description: Fetchmail
38
#
39
# Run "/sbin/chkconfig --add fetchmail"  to add the Run levels;
40
# this *should* setup the symlinks!
41
#====================================================================
42
 
43
 
44
#====================================================================
45
# Set the path to the executable.
46
#
47
FETCHMAIL=/usr/bin/fetchmail
48
 
49
# Set the path to the runtime control file.
50
#
51
FRC=/etc/fetchmailrc
52
 
53
# Path to the lock file.
54
#
55
LOCK_FILE=/var/lock/subsys/fetchmail
56
 
57
# Set this time for daemon operations.
58
TIME=74
116 - 59
#ARGS="-K -Dujsoftware.com -S homeserver.ujsoftware.com --limit 25000000 --limitflush"
189 - 60
ARGS="-K -Dujsoftware.com -S homeserver.ujsoftware.com --syslog --sslcertck"
4 - 61
 
62
#====================================================================
63
 
64
#====================================================================
65
 
66
# System checks:
67
 
68
# Source function library
69
. /etc/rc.d/init.d/functions
70
 
71
# Check that networking is up.
72
# No point in trying to send or recieve otherwise!!
73
[ ${NETWORKING} ="yes" ] || exit 0
74
 
75
# Check we have the fetchmail program installed.
76
if [ ! -x $FETCHMAIL ] ; then
77
echo "Cannot find Fetchmail executable!"
78
exit 0
79
fi
80
 
81
# Check the .fetchmailrc file exists - fetchmail doesn't run
82
# in daemon mode without it.
83
 
84
if [ ! -f $FRC ] ; then
85
echo "Cannot find the runtime control file!"
86
exit 0
87
fi
88
 
89
#====================================================================
90
 
91
prog=$"Fetchmail"
92
 
93
RETVAL=0
94
 
95
start() {
96
if [ -f $LOCK_FILE ]; then
97
  echo "Fetchmail is already running!"
98
  exit 0
99
 
100
else
101
 
102
  echo -n $"Starting $prog: "
103
  $FETCHMAIL -f $FRC --daemon $TIME $ARGS >/dev/null 2>&1
104
fi
105
 
106
RETVAL=$?
107
[ $RETVAL -eq 0 ] && success
108
echo
109
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
110
return $RETVAL
111
}
112
 
113
stop() {
114
echo -n $"Shutting down $prog: "
154 - 115
if [ -f /var/run/fetchmail.pid ]; then
116
  kill `head -1 /var/run/fetchmail.pid`
117
  RETVAL=$?
118
  [ $RETVAL -eq 0 ] && success
119
  rm -f $LOCK_FILE
120
  echo
121
  return $RETVAL
122
fi
123
echo "already down"
124
return 0
4 - 125
}
126
# See how we were called.
127
case "$1" in
128
   start)
129
start
130
;;
131
   stop)
132
stop
133
;;
134
   restart)
135
stop
136
start
137
;;
138
   condrestart)
139
if [ -f $LOCK_FILE ]; then
140
   stop
141
   start
142
   RETVAL=$?
143
fi
144
;;
145
   status)
146
status fetchmail
147
RETVAL=$?
148
;;
149
   *)
150
    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
151
    RETVAL=1
152
esac
153
 
154
exit $RETVAL