One more workaround you can do using SSH
You would generate single key pair without passphrase using command ssh-keygen from where you would execute your script. Place Public key to all of the servers. Keep private key onto the system from where you would execute script using cronjob How the script is going to be? You would write the script from where you would execute the command. Bring all the servers(ips)in loop or array. Login on to server one by one using ssh command by using private key and execute shutdown command then exit For more detail check ssh manual at (http://www.openssh.org) another bash tutorial(http://www.linuxconfig.org/Bash_scripting_Tutorial) Ofcourse, You would be shown the way to reach destination but no one would lead you there. ABS |
um, would:
Code:
ssh user@server sudo /sbin/shutdown -h now |
Thanks All for all the important pointers.Its true,all one needs is pointer and I am on my way.I will definitely share this script ones its done.Maybe we can further enrich this one once we are through.
Thanks Ajit |
Quote:
|
Quote:
The authenticity of host '135.27.153.243 (135.27.153.243)' can't be established. RSA key fingerprint is c1:99:8c:2e:37:42:e5:0f:02:84:47:85:e2:1c:cd:29. Are you sure you want to continue connecting (yes/no)? And now I have to enter is yes But I dont want to input anything I want my script to do this. Ajit |
But it only asks that once for a new machine, then it memorizes it for future ref. Its a security feature, see man-in-the-middle attack.
|
Script still failing.....
Quote:
The error I receive is Sorry, user init is not allowed to execute '/sbin/shutdown -h now' as root on S. Thanks, Ajit |
Add init to sudoers file and give him ability to run that cmd.
|
Quote:
I added this entry in the sudoers file vi /etc/sudoers. init ALL=/sbin/shutdown. And I run my script but it still gives me the same error. Obviously I did something wrong but what is it? Ajit |
this works in fedora:
http://www.linuxquestions.org/questi...1/#post3441308 is init some sort of special system user that has to do with the init command ? |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
^ but now my previous post isnt funny anymore...
|
All times are GMT -5. The time now is 06:22 AM. |