The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Security
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Security Anything involving computer security goes here.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
For Loops Within Ftp Comands jsalz638 UNIX for Advanced & Expert Users 6 10-21-2007 08:20 PM
sql inside a script kotasateesh Shell Programming and Scripting 4 04-26-2006 10:30 AM
how to find Script file location inside script asami Shell Programming and Scripting 10 03-14-2006 08:57 PM
how to identify the type of shell using comands.. swamymns Shell Programming and Scripting 2 01-17-2006 09:17 PM
External comands in C? merlin High Level Programming 2 01-07-2003 09:15 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Dec 2007
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
comands inside the script

hi,

i want to put a set of commands inside a script and executing commands sequentially. there are 2 commands, the first command copies the program from my machine to another machine, execute it and get the result on my machine. the second command removes the program which was copied to the remote machine. I have already made the ssh authentication. I need to integrate both of them in one single script so that if i run that script it gives the result. Can somebody give some suggestions?

first command
Code:
cat /path of my machine/script.pl | ssh user@remotemachine "cat > /path of the remote server where the file is copied/backup_script.pl ; perl /path of the remote server where the file is copied/backup_script.pl
second command: removing the file after executing

Code:
ssh user@remotemachine rm /path of the remote server where the file is copied/backup_script.pl
thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Oct 2007
Posts: 75
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Instead of using cat and piping, couldn't You just do something like:
Code:
#!/bin/sh
scp script.pl user@remote:
result=$(ssh user@remote script.pl)
ssh user@remote rm script.pl
echo $result
Reply With Quote
  #3 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Dec 2007
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Thanks a lot Lakris...

Code:
#!/bin/sh
scp script.pl user@remote:remote path
result=$(ssh user@remote script.pl)
echo $result
ssh user@remote rm script.pl
i jus swapped the last 2 lines of ur script, cuz it deletes the file before it gets executed.

thanks.
Reply With Quote
  #4 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Oct 2007
Posts: 75
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
NP,

Yes but the content of result is in Your local machine, isn't it? And that doesn't get deleted until You end the script.


/L
Reply With Quote
  #5 (permalink)  
Old 02-13-2008
Registered User
 

Join Date: Dec 2007
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by Lakris View Post
NP,

Yes but the content of result is in Your local machine, isn't it? And that doesn't get deleted until You end the script.


/L
ohhh k... i got it ....

thanks.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102