![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
*nix
*nix forum sponsored by |
| ||
| | | LinkBack | Thread Tools | Search Thread |
| Sponsored Links |
| | #1 |
![]() | Does anyone know of a way to run a script that'll auto connect to a server via SSH (smoothwall), login and then perform a few commands, then close the SSH session. Thanks in advance all. |
| |
| | #2 |
![]() Join Date: Jun 2005 Location: Fylde, Lancs, UK.
Posts: 10,469
Thanks: 55
Thanked 339 Times in 292 Posts
Blog Entries: 1 Rep Power: 89 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | First off, you need to swap ssh keys with the remote system so you can login without a password prompt. HOWTO: set up ssh keys At that point you can either run a single SSH command to run the script on the remote system. Code: ssh user@system /usr/bin/somescript.sh Code: ssh user@system /usr/games/fortune | /sbin/wall ssh user@system /sbin/reboot |
| |
| The Following User Says Thank You to Geoff For This Useful Post: | tom_newton (13-11-2008) |
| | #3 |
![]() Join Date: Feb 2006 Location: Derbyshire
Posts: 1,007
Thanks: 57
Thanked 111 Times in 99 Posts
Rep Power: 32 ![]() ![]() ![]() ![]() ![]() ![]() ![]() | If you mean from Windows to the Linux machine, I'd just do it with PLink the command line driven aspect of Putty... Using the command-line connection tool Plink Should do everything quite happily. |
| |
| The Following 2 Users Say Thank You to OutToLunch For This Useful Post: | tom_newton (13-11-2008), webman (12-11-2008) |
| | #4 | |
![]() Join Date: Aug 2005 Location: Alton, Hampshire
Posts: 2,142
Thanks: 245
Thanked 202 Times in 172 Posts
Rep Power: 54 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Quote:
Code: for fileLine in os.popen("PuTTY\\plink -batch -i PuTTY\\xenConsole.ppk root@" + dirName + " cat /proc/mdstat").readlines():
line = fileLine[:-1]
reResult = re.search(" *(.*) blocks \[(.*)/(.*)\] \[(.*)\]", line)
if reResult:
RAIDState = reResult.group(4)
The above connects to the server and gets the state of the mdadm RAID array, sorting through the answer with a regular expression to parse out the data needed. -- David Hicks | |
| |
| The Following User Says Thank You to dhicks For This Useful Post: | tom_newton (13-11-2008) |
| | #5 |
![]() Join Date: Sep 2006 Location: Leeds
Posts: 1,486
Thanks: 77
Thanked 139 Times in 109 Posts
Rep Power: 32 ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Thanks for the answers folks... now I am wondering what the OP was wanting and how we might officially support what he's after? |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running batch files in vista | Kained | Windows Vista | 6 | 04-09-2007 02:25 PM |
| Rename a batch of files all at once. | Kyle | How do you do....it? | 8 | 27-08-2006 08:59 PM |
| numbers and batch files | russdev | Windows | 4 | 19-11-2005 09:51 PM |
| Blocking Batch Files using Group Policy in Server 2003 | markwilliamson2001 | Windows | 13 | 04-10-2005 05:28 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
| |











