Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl scheduled task 1

Status
Not open for further replies.

jrig

Technical User
Sep 5, 2006
36
US
Wasn't sure exactly where to post this, figured this is as good a place as any.
The problem: I would like to run a perl script once a day, but when it needs to run I won't be at the computer, or logged in or have access to the server.

The setup: perl script sits on a linux box, I'm not admin so I can't run a cronjob or install any modules. The server is on the same local network as a windows machine where I can set up scheduled tasks, as well as telnet the apache server. (Not sure if I can get perl on the windows box, would that help - the original perl script MUST run on the linux)

I was thinking I could schedule a batch-type file to telnet in and execute the script but I haven't been able to get that to work, other than manually typing the commands. Also, I've seen some mentions of a while loop, but wouldn't that put an extra load on the server, and be inaccurate? Don't want to do that if possible- Thanks for any suggestions!
 
I have the same problem, and they told me cronjob. but i don't have access ether. hmmm....

Thanks,
Nate_Bro
 
If you can ask the sysadmin to set up a cron job for you, do it. They don't like it unless the script it runs is on a secure location (so that you can't change the script to do an rm -R when they p*ss you off for the 94th day in a row...)

Otherwise SSH is a better option than telnet from a security perspective. is a pure-perl implementation, so you don't need anything else on the client box.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
The setup: perl script sits on a linux box, I'm not admin so I can't run a cronjob

Unless cron is not running on a Unix/Linux system (for some bizarre reason), then every 'user' should be able run a cronjob.
Login to the system as usual, and try:
crontab -l # that is 'minus EL' not 'minus one'

1) If you get an error such as:
crontab: can't open your crontab file.

it only means that you haven't yet created a crontab file

2) If nothing happens and the prompt comes back, it means that you have a crontab file but it is empty


If 1) or 2) happens then create a small text file, (eg called: mycrontab.txt)
Code:
00 07 * * 1-5 /path/to/perl-script

then at the prompt enter:
crontab mycrontab.txt #update your crontab file
crontab -l #view your crontab file


I hope that helps (but re-post for more information or help)

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top