Re: Remotely shutdown multiple PCs via script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/09/2011 06:47 PM, Doug Kuvaas wrote:
> Here is what I am trying to do:
> 
>>From a central server running HP-UX, I would like to shutdown multiple
> Fedora PCs using a script.  This in itself is not a problem.  I have an
> account on the machines added to the sudoers file to allow them to shut
> down the systems, and connect to said systems using ssh.  I can get the
> systems to shut down remotely using the command ssh -t user@host "sudo
> /sbin/shutdown -h now".  If I run the script on the host computer it works
> like I would expect.
> 
> The problem I am running into is the host computer is typically accessed
> through one of the Fedora PCs being used to shut it down.  So when I run
> the script, it gets to the point where it is telling the current computer
> to shutdown, the script is terminated and no further systems shut down.
> 
> I have tried changing the command to the following:
> 
> ssh -t user@host "sudo /sbin/shutdown -h +1"  but the script wants to wait
> for the shutdown command to complete, which takes a minute.
> 
> ssh -t user@host "nohup sudo /sbin/shutdown -h now&" but the command seems
> to never even run (there is no nohup.out file generated)
> 
> ssh -t user@host "echo 'sudo /sbin/shutdown -h now' | at now + 1 minute"
>  but the command never seems to run
> 
> I have made another script on the target PCs that merely consists of a
> sleep command followed by the shutdown command and tried the above with the
> same result.  I have also tried using screen but again it seems like it
> doesn't work properly.
> 
> Anyone have any ideas?
---

several.

1] have a different script for each 'remote' on server, where in the
remote's script does not include itself. then shutdown 'remote' being
used manually.

2] have an "if not" condition which tests to see which 'remote' is calling
script. this way, 'remote' would be skipped and can be shutdown mannually.

3] have a script that runs from each 'remote' for shutting down other
remotes and run it in background with a shutdown after it runs.

if you want a time delay, use "-t xx" where 'xx' = time delay in seconds.

if you use "&", add a space between last of command and "&".


*please* reply *text/plain* so i do not have to go into my email's 'trash'
folder to see your reply. thank you.

> Thanks
---

welcome.

hth.
-- 

peace out.

tc.hago,

g
.

*please reply "plain text" only. "html text" are deleted*

****
in a free world without fences, who needs gates.
**
help microsoft stamp out piracy - give linux to a friend today.
**
to mess up a linux box, you need to work at it.
to mess up an ms windows box, you just need to *look* at it.
**
The installation instructions stated to install Windows 2000 or better.
So I installed Linux.
**
learn linux:
'Rute User's Tutorial and Exposition' http://rute.2038bug.com/index.html
'The Linux Documentation Project' http://www.tldp.org/
'LDP HOWTO-index' http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
'HowtoForge' http://howtoforge.com/
****

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux