![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing variable from bash to perl from bash script | arsidh | Shell Programming and Scripting | 10 | 06-04-2008 12:25 PM |
| Another bash shell to perl conversion | freak | UNIX for Dummies Questions & Answers | 6 | 05-29-2008 01:04 PM |
| Comp-3 conversion possible with Shell Scripting or PERL? | dfran1972 | Shell Programming and Scripting | 13 | 02-23-2008 07:51 PM |
| Perl conversion & perldoc question | thumper | Shell Programming and Scripting | 2 | 09-11-2005 09:24 PM |
| Conversion of bash parsing script to perl? | cstovall | Shell Programming and Scripting | 2 | 10-13-2004 10:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
bash to perl conversion
I am trying to convert the following two lines of a bash script
to perl. #start gnetcat on backup server gnetcat -l -vv -p 2011 >$STORAGE_FILEPATH$DAY/$SHORT_NAME.$timestamp.tar #start backup on client ssh $SHORT_NAME sudo tar -cvf - --exclude=/dev --exclude=/lost+found --exclude=/proc / |netcat -w 2 -c troll 2011 The first line starting gnetcat on the backup seerver works fine, however I have not been able to get the second line, sent to the client, to work. #start gnetcat on backup server system `gnetcat -l -vv -p 2011`, ">", "$filename"; #start backup on client system `ssh $SHORT_NAME sudo tar -cvf - --exclude=/dev --exclude=/lost+found --exclude=/proc --exclude=/db / |netcat -w 4 -c troll 2011`; Any help pointing out what I am doing wrong is greatly appreciated. |
|
||||
|
What do you exactly mean by "not work"? Normally, does the shell script prompt you password for ssh (or you bypass it based on "authorized_keys")?
I don't think you can use backticks in Perl if ssh gives a password prompt on connect. It may be fine for telnet or the like but likely to fail for ssh. You may also try the more "native" Perl way of doing it -- use Perl modules for SSH. Note that you need to install that module if you intend to use it. A C compiler may be needed for installation. Given so many dependencies the easiest way of installing is by "cpan". http://search.cpan.org/~dbrobins/Net...et/SSH/Perl.pm |
|
||||
|
Quote:
Quote:
Code:
system "ssh", $SHORT_NAME, "sudo", "tar", "cvf", "-", "--exclude=/dev", "--exclude=/lost+found", "--exclude=/proc" , "/|", "netcat", "-w2", "-c", "troll", "2011" ; Quote:
To cbkihong: Thanks for the reply, it got me pointed in the right direction to figure out what the problem was. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|