This is a discussion on Automated email within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; hello all, i want to run a small script which supposed to send an email when the server 1)started 2)shutdown ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
hello all,
i want to run a small script which supposed to send an email when the server 1)started 2)shutdown 3)reboot my OS :cenOS i did following: 1)created my script and added executive permissions and copied to /etc/init.d directory 2)created symbolic links in /etc/rc5.d as K90myscript and S90myscript when i created like above it was working fine and i am getting a mail to my email id successfully. i want to do the following: 1)when my system reboots i need an email alert (script should execute) 2)when my system shutdowns i need an email alert (script should execute) for the above things i created with the above script two symbolic links to rc6.d(for reboot purpose) and rc0.d(for shutdown purpose) and given the links with S(start script) . and also what i observed is that the sendmail service is stopped(K30sendmail) much before this S script(S90 script) in the above rc6.d and rc0.d directories. i think that is the only reason i am not getting the mails in the case of reboot and shutdown levels ' then how can i do it?? thanks and regards srinivas antarvedi |
| Sponsored Links | ||
|
|
|
|||
|
Create symlinks in rc0.d and rc6.d with a name like K<number-less-than-30>script_name. The K doesn't necessarily mean that a service gets killed. Its means that the script gets executed with a 'stop' argument. You don't have to use the argument passed to it.
|
|
|||
|
Hello agn(sorry i dunno your name),
Thanks for the reply.. and i tried as you described but its not working i did like this 1)kept my scirpt in /etc/init.d/ dierectory 2)created symbolic link ln -s /etc/init.d/<myscript> /etc/rc0.d/K01<myscript> 3)created symbolic link ln -s /etc/init.d/<myscript> /etc/rc6.d/K01<myscript> I have intentionally given the seqeunce name as K01 to avoid any possible chances of stopping the dependent services . still i am not getting the script worked. only script i put in /etc/rc5.d/<myscript> seems to work on reboot can u explain how to do it thanks for the help regards srinivas antarvedi |
|
|||
|
My guess is that the mail gets sent but the systems gets shutdown/rebooted before it leaves the system. Add 'sleep 30' to the end of the script and see if you get the mail. Also check your logs.
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Email Server, suggestions? | s1lent | Mail Servers | 7 | 03-09-2008 10:46 AM |
| why can't forward large email attachment? | khaosregion | Mail Servers | 4 | 10-26-2007 12:49 AM |
| need help to write automated server monitering script | vishal Titre | Shell scripting | 1 | 07-15-2006 02:35 AM |
| required linux email help | vaishalichitale | Linux software | 4 | 06-20-2006 02:20 PM |
| How to forward an email to other account | tom | Getting started tutorials | 2 | 09-25-2005 09:58 PM |