Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 18, 2008, 03:15 PM   #1
MultipleParadox
macrumors newbie
 
Join Date: Sep 2008
automating shell: SSH-ing, runing various script, etc

Hi everybody,

At work I need to run a few commands, with different parameters from time to time on a remote server using SSH.

I'd like to automate these action using <insert best solution here>

Options would be Automator, Applescript, Python, Perl or Ruby

I don't really know any of these languages, but I do have a good programming background (used with shell, done C/C++ and turbopascal long ago, Actionscript 2, php, etc)

I'd like to script to ask for the few parameters needed, and then running the scripts in order. It is important that the script can wait for the previous call to finish before it continue...

an example would be:
- ask for the target server
- ask for a campaign name
- ask for a version number
- ssh to a server "x"
- run a few scripts on server "x" using provided params
- ssh *from* server "x" to server "y"
- call a script
- cd to a certain folder
- delete a folder
- unzip a file and move it to another location afterward
- call a script

Might seem a "lot" but it's actually not much
If anyone can help me in any way, that'd be really appreciated;

Thanks to you all

O.
MultipleParadox is offline   0 Reply With Quote
Old Sep 18, 2008, 04:44 PM   #2
foidulus
macrumors 6502a
 
Join Date: Jan 2007
Do it in BASH

Most of the stuff you seem to want would be easiest to do with BASH scripts IMO. If you want to package it all into a GUI, automator would be a good front end(you can run terminal commands/scripts pretty easily from Automator)
foidulus is offline   0 Reply With Quote
Old Sep 18, 2008, 09:25 PM   #3
mobilehaathi
macrumors 601
 
mobilehaathi's Avatar
 
Join Date: Aug 2008
Location: Bay Area, CA
You could do it in perl, but I'd do it with a bash script.

-edit-

And I'd send those "ask for" items as command line args or in a parameter file that you pass on the command line or automatically search for.
__________________
The true way is along a rope that is not spanned high in the air, but only just above the ground. It seems intended more to cause stumbling than to be walked along.
mobilehaathi is offline   0 Reply With Quote
Old Sep 18, 2008, 10:35 PM   #4
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Quote:
Originally Posted by MultipleParadox View Post
I'd like to automate these action using <insert best solution here>
.
First rule: Write this in something that you know.

If it were me I'd do it in a simple sh (bash) script if I wanted it to be "quick and dirty" But if I wanted good error checking, like for example I might try to "ping" the server after the name was entered to verify it was entered correctly and was up and running. I'd check that a script was present before trying to run it and so on. It could easily be that you have 12 lines or "real" work and 200 lines devoted to errors and exceptions and printing messages about same. So Perl or bash depending on the level of error handling sophistication required.
ChrisA is offline   0 Reply With Quote
Old Sep 19, 2008, 09:37 AM   #5
MultipleParadox
Thread Starter
macrumors newbie
 
Join Date: Sep 2008
Thanks for your answers

I'd rather go with a quick and dirty solution; there's no *real* need for error checking in that case

I'll consider using Bash script and start to try and gather some info about it; If any of you have good resources online that you want to share it would be nice

Thanks again

O.
MultipleParadox is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Apple script batch shell script prramesh Mac Programming 5 Sep 15, 2013 03:35 AM
Anyone know how to use AppleScript or shell-script? gba2000 Mac Applications and Mac App Store 0 Apr 23, 2013 11:14 AM
iPhone: SSH-ing framework files saint berkut Jailbreaks and iOS Hacks 4 Mar 29, 2013 08:56 AM
Need help with a shell script thatgreenvw Mac Programming 1 Nov 30, 2012 07:55 AM
automating a set of terminal ssh commands to a clickable icon? Juz OS X 2 Jun 4, 2012 09:08 AM

Forum Jump

All times are GMT -5. The time now is 10:07 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC