aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/debian_rc
blob: 7bbdbdc8440302660efe427e8fc067ae7a1c6e4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# To start fetchmail as a system service, copy this file to
# /etc/init.d/fetchmail and run "update-rc.d fetchmail
# defaults".  A fetchmailrc file containg hosts and
# passwords for all local users should be placed in /root
# and should contain a line of the form "set daemon <nnn>".
#
# To remove the service, delete /etc/init.d/fetchmail and run
# "update-rc.d fetchmail remove".

DAEMON=/usr/bin/fetchmail

set -e
test -f $DAEMON || exit 0

case "$1" in
  start)
        echo -n "Starting mail retrieval agent: "
        if start-stop-daemon --start --quiet --exec $DAEMON; then echo "fetchmail."
        else echo "fetchmail already running."; fi
        ;;
  stop)
        echo -n "Stopping mail retrieval agent: "
        start-stop-daemon --stop --quiet --exec $DAEMON
        echo "fetchmail."
        ;;
  force-reload|restart)
        echo -n "Restarting mail retrieval agent: "
        start-stop-daemon --stop --quiet --exec $DAEMON
        start-stop-daemon --start --quiet --exec $DAEMON
        echo "fetchmail."
        ;;
  *)
        echo "Usage: /etc/init.d/fetchmail {start|stop|restart}"
        exit 1
        ;;
esac

exit 0
ass="o">->print("$username"); $host->waitfor('/Password:\s?$/'); $host->print("$passwd"); $host->waitfor('/p99dreyf>\s?$/'); $host->print("$command"); $strip=1; while ($strip) { $greeting=$host->getline(); if ($greeting=~/^\* PREAUTH.*$/) { print "$greeting"; $strip=0;}; } do { do { $cmd=<STDIN>; chop $cmd; } while ($cmd !~/[A-Za-z0-9]/); $host->print("$cmd"); print FILE ">>$cmd<<\n"; do { $line=$host->getline(); chop($line); print "$line\n"; print FILE "<<$line<<\n"; } while (($line!~/^[A-Za-z0-9]+ (OK|BAD|Expunge).*$/) && ($line!~/^\* BAD.*$/)); print FILE "--next cmd\n"; } while ($line!~/^[A-Za-z0-9]+ OK LOGOUT.*$/); exit;