LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2002, 11:56 AM   #1
safra
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Rep: Reputation: 15
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
 
Old 07-07-2002, 12:09 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
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.

Last edited by neo77777; 07-07-2002 at 12:13 PM.
 
Old 07-07-2002, 12:14 PM   #3
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 32
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/
 
Old 07-07-2002, 12:18 PM   #4
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 32
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
 
Old 07-07-2002, 12:41 PM   #5
safra
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 07-07-2002, 12:45 PM   #6
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 32
Your more than welcome
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 06:25 PM
I need help with a Perl script tarballed Programming 16 04-09-2003 07:04 PM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 05:03 AM
perl script... killjoy Programming 0 03-29-2001 03:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 AM.

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