UUGRN

Re: Benachrichtigung wenn Mails da sind

From
Mike Fabian <mike.fabian@...>
Date
Mathias Waack <mathias@...> writes:

> Ich hole Mails & News per Modem. Das Ganze wird im ip-up Script
> angestossen. Auf dem entsprechenden Rechner gibt es verschiedene
> Benutzer. Nun moechte ich eine Moeglichkeit haben, das der
> Benutzer, der die Verbindung aufgebaut hat, informiert wird wenn
> das ip-up Script fertig ist. Bisher mache ich das so, dass die
> Benutzer warten bis im syslog die entsprechende Meldung kommt.
> Allerdings ist es wohl klar, dass das syslog nicht jedem offen
> stehen soll. Welche anderen Moeglichkeiten gibt es da noch?

Ich starte die ppp-Verbindung durch Aufruf des Scripts /etc/ppp/ppp-on
aus einem xterm (mit Hilfe von `sudo', alle User, die das dürfen
bekommen einen entsprehenden in /etc/sudoers). In /etc/ppp/ppp-on
steht Folgendes:

# first write current tty to file to enable ip-up.local to be able
# to send a message to this terminal when the link is operational.

/usr/bin/tty > /etc/ppp/ppp-on.tty

# now start the link:

/usr/sbin/pppd file /etc/ppp/options.rni

Und in /etc/ppp/ip-up.local habe ich dann:

# this script is executed after the ppp link is up.

# create a file to indicate that the link is up:
touch /etc/ppp/ppp-is-up

# get the terminal where ppp-on was executed from:
outputterm=`cat /etc/ppp/ppp-on.tty`

# send an acknowledgement to this terminal:

echo "" > $outputterm
echo "--------------------------------------------------------" > $outputterm
echo "message from /etc/ppp/ip-up.local: ppp-link established." > $outputterm
echo $* > $outputterm
echo "--------------------------------------------------------" > $outputterm

/usr/sbin/sendmail -q

Und in /etc/ppp/ip-down.local steht dann Folgendes:

# this script is executed after the ppp link is shut down.

# remove file which indicates that the link is up:
rm /etc/ppp/ppp-is-up

# get the terminal where ppp-off was executed from:
outputterm=`cat /etc/ppp/ppp-off.tty`

# send an acknowledgement to this terminal:

echo "" > $outputterm
echo "--------------------------------------------------------" > $outputterm
echo "message from /etc/ppp/ip-down.local: ppp-link shut down." > $outputterm
echo "--------------------------------------------------------" > $outputterm

Wie Du siehst erzeuge ich auch einen file ppp-is-up wenn die
Verbindung steht und löschen den wieder wenn die Verbindung beendet
wird. Das benutze ich für Skripte zum automatischen Mailabholen,
ftp-downloaden usw.. Diese Skripte starten auch erstmal ppp-on, warten
dann solange bis /etc/ppp/ppp-is-up auftaucht und legen dann los.

--
Mike Fabian   <mike.fabian@...>   <mike@...>

Thread

Follow-ups: