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
This is the German Subforum, I think you are better in the English one.
So closed for the moment and reopened after moving.
Reopened now.
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.
dears any help
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
/etc/rc.local
/etc/sysctl.conf
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.
# 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.
@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.