Subversion Repositories configs

Rev

Rev 4 | Rev 116 | 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
84 - 59
ARGS="-K -Dujsoftware.com -S homeserver.ujsoftware.com --limit 25000000 --limitflush"
4 - 60
 
61
#====================================================================
62
 
63
#====================================================================
64
 
65
# System checks:
66
 
67
# Source function library
68
. /etc/rc.d/init.d/functions
69
 
70
# Check that networking is up.
71
# No point in trying to send or recieve otherwise!!
72
[ ${NETWORKING} ="yes" ] || exit 0
73
 
74
# Check we have the fetchmail program installed.
75
if [ ! -x $FETCHMAIL ] ; then
76
echo "Cannot find Fetchmail executable!"
77
exit 0
78
fi
79
 
80
# Check the .fetchmailrc file exists - fetchmail doesn't run
81
# in daemon mode without it.
82
 
83
if [ ! -f $FRC ] ; then
84
echo "Cannot find the runtime control file!"
85
exit 0
86
fi
87
 
88
#====================================================================
89
 
90
prog=$"Fetchmail"
91
 
92
RETVAL=0
93
 
94
start() {
95
if [ -f $LOCK_FILE ]; then
96
  echo "Fetchmail is already running!"
97
  exit 0
98
 
99
else
100
 
101
  echo -n $"Starting $prog: "
102
  $FETCHMAIL -f $FRC --daemon $TIME $ARGS >/dev/null 2>&1
103
fi
104
 
105
RETVAL=$?
106
[ $RETVAL -eq 0 ] && success
107
echo
108
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
109
return $RETVAL
110
}
111
 
112
stop() {
113
echo -n $"Shutting down $prog: "
114
killproc fetchmail
115
RETVAL=$?
116
[ $RETVAL -eq 0 ]
117
rm -f $LOCK_FILE
118
echo
119
return $RETVAL
120
}
121
 
122
# See how we were called.
123
case "$1" in
124
   start)
125
start
126
;;
127
   stop)
128
stop
129
;;
130
   restart)
131
stop
132
start
133
;;
134
   condrestart)
135
if [ -f $LOCK_FILE ]; then
136
   stop
137
   start
138
   RETVAL=$?
139
fi
140
;;
141
   status)
142
status fetchmail
143
RETVAL=$?
144
;;
145
   *)
146
    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
147
    RETVAL=1
148
esac
149
 
150
exit $RETVAL