ssh script

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

ssh script

Postby Ghost » Thu Jun 23, 2005 1:22 pm

Hey guys :D

I'm in need of a litle help, and not too sure if here is the right place to ask so...

I'm using Mac OS X 10.4.1 and im trying to make a script that will ssh into my clarkconect box which in turn will run another script.

I would like this script to be able to leave a log of the entire prossece errors and all on my mac.

As this is the first time ive had to do some thing like this i was kinnda hope you Linux/*nix gurus would know this one i did try google first but came up with automated linux install's ?

thanks
Ghost
 

RE: ssh script

Postby nelz » Thu Jun 23, 2005 1:55 pm

Not sure about the Mac-specifics, but

Code: Select all
ssh hostname script >>script.log


will run "script" on "hostname" and send the output to a logfile in the current directory. The redirection takes place in the current shell, you are logging the output of the ssh command, which in turn is the output of the command it runs, so all you need to do is have your script on the clarkconnect box send its output to stdout.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8497
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

RE: ssh script

Postby Guest » Thu Jun 23, 2005 2:48 pm

Ok, that did not work :(, i can ssh into the Linux box with out the password, now all i need is a mac os x script that will run ssh the run the script on the linux box then leave a log on the mac box ???
Guest
 

RE: ssh script

Postby nelz » Thu Jun 23, 2005 5:23 pm

What does "that did not work" mean? What did you do? What did you expect to happen? What happened?I know it works with Linux to Linux, I did exactly that less than an hour before you asked.

Code: Select all
ssh hostname command


runs command on hostname, but all output goes to stdout on the local box, so you only need redirection to log it.

I think you really need to give some more specific information, rather than vague references to unknown scripts and no error messages.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8497
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

RE: ssh script

Postby skecs » Sat Jun 25, 2005 6:18 am

Firstly, have you enabled remote login? It is disabled by default, to enable go to the Sharing Pane in System Preferences.

Secondly, if you have enable File Vault the home folders must be mounted to access them. In other words you need that user to be logged in or you can't access those directories.

You can connect from a terminal using another Mac OS X, so you should be able to using a terminal on Linux.
Regards from
Downunder!
.... _
... (0)>
... / /\
.. / / .)
.. V_/_
Linux Powered!
User avatar
skecs
 
Posts: 76
Joined: Fri Apr 22, 2005 9:22 am
Location: Bathurst, NSW Australia


Return to Help!

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests

cron