Subversion Repositories configs

Rev

Rev 84 | Rev 154 | Go to most recent revision | 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"
60
ARGS="-K -Dujsoftware.com -S homeserver.ujsoftware.com"
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: "
115
killproc fetchmail
116
RETVAL=$?
117
[ $RETVAL -eq 0 ]
118
rm -f $LOCK_FILE
119
echo
120
return $RETVAL
121
}
122
 
123
# See how we were called.
124
case "$1" in
125
   start)
126
start
127
;;
128
   stop)
129
stop
130
;;
131
   restart)
132
stop
133
start
134
;;
135
   condrestart)
136
if [ -f $LOCK_FILE ]; then
137
   stop
138
   start
139
   RETVAL=$?
140
fi
141
;;
142
   status)
143
status fetchmail
144
RETVAL=$?
145
;;
146
   *)
147
    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
148
    RETVAL=1
149
esac
150
 
151
exit $RETVAL