Page 1 of 1

E-Mail notification bei reboot

Posted: 2007-06-12 07:45
by rfc
Hi,

ich wuerde gerne eine E-Mail notification bekommen wenn mein System rebooten (wird). An und fuer sich fuer mich kein Problem, schmeiss ich ihn rc2.d ein script das ne mail verschickt.

Ich verwende Debian und wollte an der Stelle rausfinden ob es da vielleicht schon etwas bestehendes gibt, dass man verwenden kann. Es waere auch nicht uninteressant eine E-Mail bei shutdown zu bekommen, da weiss ich dann aber nicht genau in welches runlevel ich das wie reinschmeissen muesst.

Bei shutdown kann man eine Message angeben; diese in solch einer E-Mail zu haben waere auch nicht schlecht. Jetzt koennt ich natuerlich einen eigenen Wrapper um shutdown herum machen.

Ist das gute Practice oder gibts was intelligenteres?

thx

Re: E-Mail notification bei reboot

Posted: 2007-06-12 07:53
by captaincrunch
logwatch macht sowas automatisch (und mehr).

Re: E-Mail notification bei reboot

Posted: 2007-06-18 23:35
by lord_pinhead
Wozu ein init Script wenn man Cron nutzen kann ;)

@reboot root /usr/bin/mail ........

Re: E-Mail notification bei reboot

Posted: 2007-06-18 23:51
by Joe User
Und welcher ungepatchte Crond unterstützt diese Syntax?

Re: E-Mail notification bei reboot

Posted: 2007-06-19 08:05
by rfc
Joe User wrote:Und welcher ungepatchte Crond unterstützt diese Syntax?
Ich vermute der von Debian tuts, super, muss ich nur noch testen :)

man 5 crontab

Code: Select all

       Instead of the first five fields, one of eight special strings may appear:

              string         meaning
              ------         -------
              @reboot        Run once, at startup.
              @yearly        Run once a year, "0 0 1 1 *".
              @annually      (same as @yearly)
              @monthly       Run once a month, "0 0 1 * *".
              @weekly        Run once a week, "0 0 * * 0".
              @daily         Run once a day, "0 0 * * *".
              @midnight      (same as @daily)
              @hourly        Run once an hour, "0 * * * *".

Re: E-Mail notification bei reboot

Posted: 2007-06-19 08:38
by dtdesign
Nimm doch einfach einen Eintrag im Runlevel 5/6 oder so, wird ja beim Herunterfahren ausgeführt.

Re: E-Mail notification bei reboot

Posted: 2007-06-19 16:49
by Roger Wilco
Joe User wrote:Und welcher ungepatchte Crond unterstützt diese Syntax?
Der crond von Paul Vixie. Der ist Standard in Debian und einigen anderen Distributionen.

Re: E-Mail notification bei reboot

Posted: 2007-06-19 16:51
by daemotron
Und wird u. a. von Joe User selbst eingesetzt bzw. empfohlen *scnr* 8)

Re: E-Mail notification bei reboot

Posted: 2007-06-19 17:02
by Joe User
Roger Wilco wrote:Der ist Standard in Debian
IIRC erst ab Etch, daher mein versteckter Hinweis ;)

Re: E-Mail notification bei reboot

Posted: 2007-06-19 17:09
by flo
bei Sarge auch schon ... zumindest kann ich micht daran erinnern, daß ich mal "cron" installieren musste oder explizit "v(ixie-)cron" sagen musste!?