LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-16-2005, 11:57 PM   #1
sikkalgopal
Member
 
Registered: Aug 2004
Location: india
Distribution: Mandrakes,Redhats,Debians.Suses and FreeBSD
Posts: 52

Rep: Reputation: 15
continuous running a pl script


Hi all,
i want to run a pl script continuously say every 3 min in my redhat 9.0 box what to do?
Thanks in advance
 
Old 02-17-2005, 12:23 AM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
put it in your crontab
 
Old 02-17-2005, 01:14 AM   #3
ogmoid
Member
 
Registered: Jul 2004
Location: Coeur d'Alene Idaho
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
I think you could add
Code:
sleep 180;
To your loop to achieve this.
You might also try alarm

For usage info see:
perldoc -f sleep
or
perldoc -f alarm
 
Old 02-17-2005, 03:38 AM   #4
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
i made a script to continuously run every 5 min. in bash by making an infinite while loop and sleep 300

here it is to get an idea :

Code:
#!/bin/bash
#
# Apollon check script
#
#
# To use it type :  ./check.sh filename
#

# Take the value that you entered and puts it in this variable
FILENAME=(*."$1"*)

# Checks the folder your in for the filename , its not used
FILENAME2=$(ls | grep "$1")

FILENAME3=${FILENAME2#*.}

echo "FILENAME = $FILENAME"

# echo "FILENAME2 = $FILENAME2"

echo "FILENAME3 = $FILENAME3"

echo -e "\033[0;31mRunning script now\033[0m"

while true; do

if [ -f "$FILENAME3" ]; then

    echo "File $FILENAME3 downloaded"  | mutt -s "File downloaded" myemail@gmail.com
    exit

elif [ -f "$FILENAME" ]; then

    echo "File $FILENAME is still being downloaded"

else
    echo "File not found"
    exit
fi

sleep 300       # sleeps for 5 minutes then checks again
done
 
Old 02-17-2005, 08:58 AM   #5
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
your system does things for a reason. getting in the habit of running tasks in the background with sleep states will make your system bloated. use cron
 
Old 02-17-2005, 11:07 AM   #6
ogmoid
Member
 
Registered: Jul 2004
Location: Coeur d'Alene Idaho
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
Quote:
Originally posted by secesh
your system does things for a reason. getting in the habit of running tasks in the background with sleep states will make your system bloated. use cron
Hear hear!

If it's just going to get ran occasionally (ie. one user; while they're logged in) then sleeping the script makes more sense to me, especially since the repeat is fairly short.

I, whole heartedly, agree with you in general.
 
Old 02-19-2005, 05:05 AM   #7
sikkalgopal
Member
 
Registered: Aug 2004
Location: india
Distribution: Mandrakes,Redhats,Debians.Suses and FreeBSD
Posts: 52

Original Poster
Rep: Reputation: 15
Hi all
i added in crontab as */5 in the minute filed.now its working great .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
continuous reboot aa1yb Linux - Newbie 5 02-05-2005 10:24 AM
Continuous Wifi Hassles - WTF!? DrakIE Linux - Newbie 1 11-19-2004 04:25 PM
Strange continuous output Nightfrost Linux - General 2 11-02-2004 04:28 AM
Program on boot-up won't stop running in a continuous loop... CanadianSlacker Slackware 6 01-14-2004 01:06 AM
Continuous disk access with RedHat 8.0 dmadhava Linux - General 13 11-20-2002 09:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:35 PM.

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