Server shutdown using scripts
I need a shell script in RHEL AS 4.5 for shutdwon the server. The script will run by a normal user. This script will keep track when the server was shutdown.
Please help me regarding this |
Unless I am not understanding you correctly, there is no reason to actually have a script for this.
Normal users can be allowed to shut the machine down through the use of sudo, and the record of when the server has been rebooted, shutdown, or had it's run level changed can be viewed with the command "last -x". You could replicate that functionality with a script if you wanted to...but I am not sure why you would. |
sudo is also a safe way to do this sort of thing, and you can configure exactly what commands each person is allowed. You then also have the sudo log to see who did what in addition to the other system log files telling when a system was shut down.
|
thanks for your early reply
My need is that, I want to shutdwon all my linux servers using a batch or shell script from remote end. Can anyone help regarding this? |
If you want to shutdown a server remotely, you simply need to do something along the lines of:
Code:
ssh user@server sudo poweroff This will be logged as a use of sudo on the remote server. Did you want to log this on the local server as well? |
yes, i want to log this in local server.
|
All times are GMT -5. The time now is 08:27 AM. |