LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2005, 06:19 AM   #1
Brnzwngs
Member
 
Registered: Jun 2005
Location: Netherlands
Distribution: Gentoo
Posts: 32

Rep: Reputation: 15
Question Shell Script to shutdown network computers?


Hey guys, I am attempting to make a shell script called shutemdown that would shutdown all the computers on my network...but I have no clue how to do that yet haha. Any suggestions? The only idea that I have come up with so far is to ssh into each computer and have shutdown -h now run. There was be a simple way.... Is there also any way to shutdown all computers including windows ones or would I only be able to shutdown linux computers? Thanks in advance!
 
Old 09-11-2005, 06:23 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you could use rexec to do this, but personally i'd suggest using ssh as you have already speculated. it will (presumably) already be running unlike rexecd and nice and secure. just run "ssh hostname poweroff" for each hostname (on a loop) using rsa or dsa shared key authentication, job's a good 'un.
 
Old 09-11-2005, 06:35 AM   #3
Brnzwngs
Member
 
Registered: Jun 2005
Location: Netherlands
Distribution: Gentoo
Posts: 32

Original Poster
Rep: Reputation: 15
I'm still really new to this so sorry for the really basic questions here:

What is rexec?

All that I would have to do is 'ssh computer poweroff'? I would still need to replace computer with the computer's hostname....

Thank you for your help!
 
Old 09-11-2005, 07:48 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
rexec (as any online documentation would tell you) is a remote execution program. to run programs on a remote machine. there's not necessarily a need for a specific server to run just for that, as ssh can do it too.

and yes, unless your server is psychic, you'd need to replace the hostname each time ;-)
 
Old 09-11-2005, 09:41 AM   #5
Brnzwngs
Member
 
Registered: Jun 2005
Location: Netherlands
Distribution: Gentoo
Posts: 32

Original Poster
Rep: Reputation: 15
Haha thanks so much! I got the script working mainly, but it makes me type the password for each logon....how can I put the password into the ssh root@x.x.x.x poweroff command?
 
Old 09-11-2005, 10:28 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
i already said... use shared keys.
 
Old 09-11-2005, 10:28 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
http://www.linuxquestions.org/questi...ticle&artid=79
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Req. Shell script: Network performance test altu Solaris / OpenSolaris 6 08-08-2004 11:45 PM
mail script not working on Macs computers AZDAVE Linux - General 4 04-02-2004 11:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration