Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 4th, 2004, 1:45 PM   #1
Coume
Newbie
 
Join Date: Jun 2004
Posts: 2
Rep Power: 0 Coume is on a distinguished road
Hello,

I tried to do a small perl script to check if amule is running and if it's not to launch it, but that's not working...
I never ever programmed in perl before, it must be a dumb error, but I can't find it

any idea?
#!/usr/bin/perl
$cmd="ps -A | grep amule | grep -v grep";
$output=qx/$cmd/;
if ($output!=~m/$amule/) {
qx/amule/;
}

Thxs
Ludo
Coume is offline   Reply With Quote
Old Jun 4th, 2004, 6:22 PM   #2
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,629
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
could you help us out by letting us know what kind of error you are getting when you try to run the program that will help a lot, thanks
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is online now   Reply With Quote
Old Jun 5th, 2004, 5:27 AM   #3
Coume
Newbie
 
Join Date: Jun 2004
Posts: 2
Rep Power: 0 Coume is on a distinguished road
Basically, it gives no error but does nothing

I am kind of sure that the problem come from the 2 first lines...
$cmd="ps -A | grep amule | grep -v grep";
$output=qx/$cmd/;

cos if I try only that in the script, it only takes the ps -A part, as if it cut aftyer the |

Ludo
btw, i'm the owner of MythTVtalk.com
Coume is offline   Reply With Quote
Old Jun 5th, 2004, 9:09 PM   #4
sykkn
Hobbyist Programmer
 
Join Date: Apr 2004
Location: Texas
Posts: 106
Rep Power: 5 sykkn is on a distinguished road
The problem is that $output!=~m/$amule/ is not correct ... instead of !=~ you should have used !~ ... so: $output !~ m/$amule/
__________________
[ [ SykkN alloc ] initWithThePowerTo: destroyYouAll ];
/* Don't make me use it! */
sykkn is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:56 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC