Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Perl (http://www.programmingforums.org/forum21.html)
-   -   Simple script but not working :( (http://www.programmingforums.org/showthread.php?t=46)

Coume Jun 4th, 2004 1:45 PM

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

big_k105 Jun 4th, 2004 6:22 PM

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 :)

Coume Jun 5th, 2004 5:27 AM

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 ;)

sykkn Jun 5th, 2004 9:09 PM

The problem is that $output!=~m/$amule/ is not correct ... instead of !=~ you should have used !~ ... so: $output !~ m/$amule/


All times are GMT -5. The time now is 6:22 PM.

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