LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-28-2006, 05:13 AM   #1
Narayandutt
LQ Newbie
 
Registered: May 2006
Posts: 11

Rep: Reputation: 0
clamd upgradation in remote mach through local mac by script to be run on local mach


hi Everybody,
I wants to run the clamd upgradation
on the remote servers.I have made a script for that
but how do I run that script on the remote server
When I write a line in My script as autossh 'ip addr of
server'it logins to that server but the script
execution is aborted and when I logout from the remote
server, My script does the clamd upgradation in My local machine. I wants the script to work some thing like this.
My script should ask me for the IP add of the remote server on which clamd upgradation need to be done.As soon as I give the IP address all the further commands of My script which are essential for clamd upgradation should be run on remote machine not in My local machine

Thanks
 
Old 11-28-2006, 03:11 PM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
You need two different scripts:
1) the upgrade script itself, which can run on any machine
2) a second script that copies the first script to the target machine and runs it there (scp, then ssh).
 
Old 11-29-2006, 08:22 AM   #3
Narayandutt
LQ Newbie
 
Registered: May 2006
Posts: 11

Original Poster
Rep: Reputation: 0
idea of second script

hi,
you are right that I need two scripts. First one is to upload
in the target machine and second one to run their. can u give idea how the second script would be.

Thanks
 
Old 11-29-2006, 11:00 AM   #4
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
The second script is quite basic. Let's call it "cpex" (copy and exec). Then you would call it with "./cpex machinename scriptname". The script would do the following steps:
- scp scriptname root@machinename:/root -> that copies the local script "scriptname" to the directory /root on the remote machine
- ssh root@machinename:/root/scriptname -> that executes the script.
That is, assuming the script needs to be run as root on the remote machine. If not, use a less powerful userid.
Now both scp and ssh will ask you to enter the password of the remote user. If that is a problem, you need to read on ssh to see how you work with certificates.
 
  


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 to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 08:20 AM
howto execute for loop on remote mach using shell script dsids Linux - Newbie 1 08-22-2006 04:07 AM
LXer: Should Apple switch Mac OS X from Mach to Linux kernel? LXer Syndicated Linux News 0 12-15-2005 11:01 AM
Mach Speed M/B mimsmall Mandriva 1 03-02-2004 01:40 AM
mach / hurd blabla KayJay Linux - Software 0 04-11-2002 06:57 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration