LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   stopping a perl script (https://www.linuxquestions.org/questions/linux-newbie-8/stopping-a-perl-script-25259/)

safra 07-07-2002 11:56 AM

stopping a perl script
 
Hi,

I am experimenting with a perl script run from the command prompt and looping in the background.

This is working fine. But as I am tweaking the perl script I need to be able to restart it.

When I try this I get the message:
Address already in use

How can I stop the script that is currently running in order to test the new one?

Thanks,
Ron

neo77777 07-07-2002 12:09 PM

ps -ef
will give you all the processes currnetly running on your system with their PID's, just grep the script from it
ps -ef | grep -i script_name | grep -vv grep
use
kill -9 process id (PID)
to kill it
P.S. if the script is just used to run a job at background something like
system ("mozilla &");
then you should grep out the background process in this case mozilla and kill it.

pickledbeans 07-07-2002 12:14 PM

killall perl_script_name

Before diving into Perl you should learn the basic of Unix administration srtarting with this how to:

http://tldp.org/HOWTO/DOS-Win-to-Linux-HOWTO.html

And moviing on to these:
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://tldp.org/LDP/abs/html/

pickledbeans 07-07-2002 12:18 PM

Quote:

Originally posted by neo77777
ps -ef
P.S. if the script is just used to run a job at background something like
system ("mozilla &");
then you should grep out the background process in this case mozilla and kill it.

Another way is to bring the command back to the foreground and [Cntrl]+c

ie.

$ my_scipt.pl &

$ fg

$ my_script.pl; [Cntrl]+c

safra 07-07-2002 12:41 PM

You guys are quick! :)

I just found out about kill. But then I thought how to get the matching process process number so thanks for that tip NEO77777

Thanks for those links and especially that last tip, Pickledbeans. Makes things easier!

Ron

pickledbeans 07-07-2002 12:45 PM

Your more than welcome :)


All times are GMT -5. The time now is 10:25 PM.