|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
I need to do a job in server every 1 mintue, so I write a perl script to this job. Thus, I use the command while() and sleep() in my program, but the server need many... memory to do it. How can I solve this problem?
my perl script: ------------------------------------ use Mysql; $dbh=Mysql->Connect($sql_host,$sql_db,$sql_user,$sql_pass); while (1) { $result=$dbh->Query("select * from table"); $count=$result->numfields; for ($i=0;$i<$count;$i++) { print $data[$i],"t"; } print "n"; sleep(60); } exit(0); |
|
#2
|
|||
|
|||
|
How about putting that program inside a crontab??
|
|
#3
|
|||
|
|||
|
dwarf,
How to use the crontab command? Could u mind to teach me? Thanks! |
|
#4
|
|||
|
|||
|
its no big deal. Under all UNIX systems, there as a damon that is called crontab, which is used to execute a certain command in some period of time which is given to it. I cannot tell you all there is about crontab (too long for this post), but there are several resources you can use to learn something about it:
1) you can type man cron from the shell prompt (or man cron | col -b > cron.txt if you want to print it) 2) Go to http://www.attrition.org/security/n...nix/cron-1.html and read it. HTH. |
|
#5
|
|||
|
|||
|
I have written a simple script 2 weeks ago. I don't know if this could help. go to.URL [Edited by Khaled on 01-16-2001 at 02:50 PM] |
|
#6
|
|||
|
|||
I try to use the crontab command, but it doesn't work. ![]() the script in crontab: ---------------------------------- * * * * * root perl /home/file1.pl |
|
#7
|
|||
|
|||
|
Hm, thats strange. Could you post the code of your script, or maybe some error messages. What does crontab tell you?? Or it simply doesn't execute the script??
|
|
#8
|
|||
|
|||
|
I already solve it. It is no need to use the "root" in the script.
wrong: * * * * * root perl /home/file1.pl right: * * * * * perl /home/file1.pl |
|
#9
|
|||
|
|||
|
Well, its nice to see you worked out your problem...
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > a job in server every 1 mintue. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|