Results 1 to 7 of 7

Thread: How to be notified by email of a Server restart or Shutdown?

  1. #1

    Exclamation How to be notified by email of a Server restart or Shutdown?

    dears i'm using Opensuse 42.1 (LTSP server) i need any way to make this server send to me any notification on my mail before or after restart and shutdown

  2. #2
    Join Date
    Mar 2011
    Location
    Sauerland
    Posts
    3,952

    Default AW: How to be notified by email of a Server restart or Shutdown?

    This is the German Subforum, I think you are better in the English one.

    So closed for the moment and reopened after moving.

  3. #3
    Join Date
    Mar 2011
    Location
    Sauerland
    Posts
    3,952

    Default AW: How to be notified by email of a Server restart or Shutdown?

    Reopened now.

  4. #4
    Join Date
    Nov 2013
    Location
    Kamloops, BC, Canada
    Posts
    3,974

    Default Re: How to be notified by email of a Server restart or Shutdown?

    Quote Originally Posted by karimadam View Post
    dears i'm using Opensuse 42.1 (LTSP server) i need any way to make this server send to me any notification on my mail before or after restart and shutdown
    I do not know the answer, but I would like to caution you: openSUSE Leap 42.1 is way past EOL. You should at least update to 42.3, if not to the latest 15.0.
    -Gerry Makaro
    Fraser-Bell Info Tech
    Solving Tech Mysteries since the Olden Days!
    ~~
    If I helped you, consider clicking the Star at the bottom left of my post.

  5. #5

    Default Re: How to be notified by email of a Server restart or Shutdown?

    dears any help

  6. #6
    Join Date
    Sep 2008
    Posts
    2,997

    Default Re: How to be notified by email of a Server restart or Shutdown?

    I've never done this but take a look at the crontab and sendmail man pages
    https://linux.die.net/man/5/crontab
    https://linux.die.net/man/8/sendmail.sendmail
    also take a look at these files
    Code:
    /etc/rc.local
    /etc/sysctl.conf

  7. #7
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,131

    Default Re: How to be notified by email of a Server restart or Shutdown?

    It is trivial for a machine to send a mail notification when it starts. It cannot send anything once it has started to shutdown/halt or been powered off externally. It would be possible for a known process that is causing the shutdown to send a mail first, but the only reliable notification would have to come from external monitoring.

    To notify of restart create an appropriate root crontab entry.
    Code:
     # crontab -e -u root
    This will open the crontab using root's default editor (usually vim)
    Create a line something like the following, with no leading whitespace.
    Code:
    @reboot  mailx -s "$HOST has restarted"  karim.adam@example.com < /dev/null
    Make sure that the mail transfer agent (postfix) is running and that you can receive mail from the server. Check by using the mailx command from bash when logged in as root. If the mail does not arrive “postqueue -p” can help diagnose mail problems

    I have been doing stuff like this for years and it does work.
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •