Skip to main content
added 87 characters in body
Source Link
AnFi
  • 1.6k
  • 7
  • 10

You can use sendmail directly to send the email.
Using custom shell script would make it "cleaner".

1 make crontab execute custom script

@reboot  .../reboot-notify
  • make crontab execute custom script

    @reboot .../reboot-notify

  • make the script use sendmail directly

2 make thesimple script use sendmail directly(e.g. you can make it check that IP address has changed)

#!/bin/sh
HOSTNAME=`hostname`    

/usr/sbin/sendmail -i [email protected] <<END
Subject: System restart

Server has restarted: $HOSTNAME
END

You can use sendmail directly to send the email.
Using custom shell script would make it "cleaner".

1 make crontab execute custom script

@reboot  .../reboot-notify

2 make the script use sendmail directly

#!/bin/sh
HOSTNAME=`hostname`    

/usr/sbin/sendmail -i [email protected] <<END
Subject: System restart

Server has restarted: $HOSTNAME
END

You can use sendmail directly to send the email.
Using custom shell script would make it "cleaner".

  • make crontab execute custom script

    @reboot .../reboot-notify

  • make the script use sendmail directly

simple script (e.g. you can make it check that IP address has changed)

#!/bin/sh
HOSTNAME=`hostname`    

/usr/sbin/sendmail -i [email protected] <<END
Subject: System restart

Server has restarted: $HOSTNAME
END
Source Link
AnFi
  • 1.6k
  • 7
  • 10

You can use sendmail directly to send the email.
Using custom shell script would make it "cleaner".

1 make crontab execute custom script

@reboot  .../reboot-notify

2 make the script use sendmail directly

#!/bin/sh
HOSTNAME=`hostname`    

/usr/sbin/sendmail -i [email protected] <<END
Subject: System restart

Server has restarted: $HOSTNAME
END