LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-09-2007, 10:13 AM   #1
lene
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Rep: Reputation: 0
how to start perl script via ssh?


Good afternoon to everybody!
i want to execute the perl script which would monitor some parameters in the network like jitter, bandwidth ...so on
i want all the process to be automated so i wrote bash file which is evoked via ssh

#!/bin/sh
killall mgen;
cd root/myfolder/mgen;
mgen input listenscript.mgn | ./mgenparse.pl $@

first of all it kills mgen traffic generator if it is running and then it should start new instance of mgen which will forward the output into mgenparse.pl perl script.
inside the perl script i do have redirection back to reply.sh

ssh root@10.1.1.12 /opt/java.1.6/bin/java class.monitor $@;

when i run all this it seems that first bash is running but i have doubts if mgenparse.pl starts
at all and whether it makes the reply back via reply.sh, i use pub.key authentication so no password is required.
I have doubts whether the format of bash file is correct so far...
can somebody help me?

thanks
 
Old 08-09-2007, 02:28 PM   #2
fvu
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu 7.10
Posts: 28

Rep: Reputation: 15
You might try quoting "$@" always. This preserves whitespace and is normally desired. Example:

Code:
$> set -- 'foo bar'  # Single argument 'foo bar'
$> for i in $@; do echo arg: $i; done  # $@ (unquoted) becomes two arguments
arg: foo
arg: bar
$> for i in "$@"; do echo arg: $i; done  # "$@" (quoted) stays one argument
arg: foo bar
See also:
http://fvue.nl/wiki/Bash:_Difference_between_$@_and_$*

Freddy Vulto
http://fvue.nl/wiki/Bash

Last edited by fvu; 08-09-2007 at 04:00 PM.
 
Old 08-10-2007, 06:34 AM   #3
lene
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
thanks but still no result...
for now i get the following type or errors:

mgen version 4.0x6
mgen: starting now...
UdpSocket: bind() error: Address already in use
MgenSocketList::Item::Open() Error: socket open error
MgenProcessDrecEvent (LISTEN) Error:socket open error on port 5000
MgenProcessDrecEvent (IGNORE) Error:no socket on port 5000
mgen: Done
 
Old 08-10-2007, 02:34 PM   #4
fvu
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu 7.10
Posts: 28

Rep: Reputation: 15
Looks like mgen errors on server...? Try ssh to server and execute the command manually.

If you want to check if mgenparse.pl starts, write message to log file within mgenparse.pl and check log file afterwards.
 
Old 10-24-2007, 02:37 AM   #5
lene
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
ok, merci, finally its working
 
Old 10-24-2007, 07:20 AM   #6
lsteacke
Member
 
Registered: Jul 2007
Distribution: Ubuntu
Posts: 99

Rep: Reputation: 16
Just curious, where did you learn about mgen?? and was it a socket problem?
 
Old 10-24-2007, 09:13 AM   #7
lene
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
we needed traffic generator, so we found it!
http://cs.itd.nrl.navy.mil/work/mgen/
well about the problem...it was solved with
killall mgen
line which i put in the beginning of the script, so i just release socket by forcing to quit any running instance of mgen.
But i noted some other strange thing,
I have written script for generation of traffic like for 6 min, but while executing i noted that sometimes it just drops...so like run 2-3 min and then i do not observe traffic anymore...
 
  


Reply

Tags
fedora 6


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script to start a service using ssh brazilian_user Linux - General 6 11-09-2006 11:14 AM
need a perl script to stop & start program cccc Programming 43 07-23-2005 07:27 PM
howto start a perl script only from tuesday to friday at 8.00 am ? cccc Linux - Newbie 4 03-19-2005 04:23 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 05:03 AM


All times are GMT -5. The time now is 06:08 PM.

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
Open Source Consulting | Domain Registration