For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > October 2004 > system command via perl script??









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author system command via perl script??
Eric Haskins

2004-10-04, 8:57 pm

Hello,

I currently develop in PHP but I have hit a wall. Is it possible to run
this command and variations of it

killall -USR2 appname

via a web script in perl?? I have an app that runs on my development server
and cant get PHP system() or exec() to work. If it is possible please
direct me to some info on it.

--
Eric Haskins
RackSPEED.Net
WebHosting from $4.99/month
Dedicated Servers
Multiple UpStream Providers


Jim Gibson

2004-10-04, 8:57 pm

In article <QKj8d.49986$Si.9769@tornado.tampabay.rr.com>, Eric Haskins
<hostmaster_s_p_a_m@rackspeed.net> wrote:

> Hello,
>
> I currently develop in PHP but I have hit a wall. Is it possible to run
> this command and variations of it
>
> killall -USR2 appname


Yes.

>
> via a web script in perl?? I have an app that runs on my development server
> and cant get PHP system() or exec() to work. If it is possible please
> direct me to some info on it.


Perl has a built-in kill function, but it works on PID numbers, not
command names. You can also run the system version of killall with
Perl's system function. If you have access to a perl installation, you
can get more information with

perldoc -f kill
perldoc -f system


A quick search of CPAN (http://search.cpan.org) yields the
Proc::ProcessTable module with its associated Proc::Killall module.
Those might prove useful. If they are installed in your perl, do

perldoc Proc::ProcessTable
perldoc Proc::Killall

If that yields nothing, they are probably not installed. You can
install modules with

perl -MCPAN -e shell
Joe Smith

2004-10-05, 8:56 am

Eric Haskins wrote:

> Hello,
>
> I currently develop in PHP but I have hit a wall. Is it possible to run
> this command and variations of it
>
> killall -USR2 appname
>
> via a web script in perl?? I have an app that runs on my development server
> and cant get PHP system() or exec() to work.


Are you having problems with system() in general, or just with killall?
If it is the latter, then it is probably because the web server is
running with a different UID than the app is running with.
-Joe
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com