Register
It is currently Fri Jul 25, 2014 9:57 am

autorun script over ssh


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Fri Apr 29, 2011 9:55 am   

Joined: Mon Nov 08, 2010 10:39 am
Posts: 17
Hello,

I have many servers and I am writing a script which allows me to upload it to the servers and perform some instructions like to install a program, etc. I use something like:
Code:
{
sudo ssh -T $host <<-EOF
      wget -c $path/$file
      bash $file
EOF
} 2>/dev/null


Where 'file' is a shell code with the proper instructions. Is there any possibility to scp file to a server and run it automatically since it's been uploaded? This will simplify and speed up the script's work cause I have too many servers: 500 or so.

Thank you.


Top
 Profile  
 PostPosted: Mon May 02, 2011 12:09 pm   

Joined: Mon Nov 08, 2010 10:39 am
Posts: 17
Ok, I decided to use the following code which suits my needs:
Code:
{
sudo ssh -T $host <<-EOF
      wget -c $path/$file
      nohup bash $file
      exit
EOF
} 2>/dev/null


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP