Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-15-2006, 06:04 PM   #1
LQ Newbie
Registered: Sep 2006
Posts: 2

Rep: Reputation: Disabled
Post cron job to execute automatically


I'm new to cron and i'm running the script through a command line (SSH)...

Everything works perfect when I execute the script manually. The script btw, is just a simple script that checks an email account for an email and forwards it to a mailing list. As I have no idea when the user will send a mail the the list, I need to check the account often (say every 15 minutes or so)

The script:

/usr/bin/perl /home/sites/<hide my address>/cgi-bin/dada/plugins/ >/dev/null 2>&1

when run manually works perfect but when I try time it by appending 15 * * * * to the script

15 * * * * /usr/bin/perl /home/sites/<hide my address>/cgi-bin/dada/plugins/ >/dev/null 2>&1

I tried to use the watch command and got bash: command not found when the script tried to execute should give an idea of what i'm about!

I'm lost here and my host provider can't help with such a tech question as it does not realate to an issue/problem with the server........

Thanks guys n gals

Old 09-15-2006, 07:19 PM   #2
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
You have misunderstood the instructions on the site you've posted a link to. Double check the section titled "Set the cron job".

The line:

15 * * * * /usr/bin/perl /home/sites/<hide my address>/cgi-bin/dada/plugins/ >/dev/null 2>&1
does NOT go in your script. It's a crontab entry. Put it in your crontab file. You don't add a line to your script to make it run every fifteen minutes; you add a line to your crontab file to make the cron daemon execute your script every fifteen minutes.

See the crontab manpage (man crontab). It will tell you how to edit the file (with crontab -e) as well as the syntax.

By the way, what you have already posted will not run once every 15 minutes, but rather once every time the minutes are equal to 15 (at 1:15, 2:15, 3:15, etc). You probably want this:
*/15 * * * * /usr/bin/perl /home/sites/<hide my address>/cgi-bin/dada/plugins/ >/dev/null 2>&1
which will run once every fifteen minutes. Once again, the crontab manpage explains this WAY better than I can.

Last edited by zhangmaike; 09-15-2006 at 07:20 PM.
Old 09-16-2006, 08:35 AM   #3
LQ Newbie
Registered: Sep 2006
Posts: 2

Original Poster
Rep: Reputation: Disabled


Thanks for that! As it so happens, I do not have access to crontab on the server anyway as they don't allow permanent server side processes... Even if they only run once an hour

I'll try find a way around it


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Cannot execute rsync as a cron job jdaniels73 Linux - Software 2 09-03-2006 05:03 AM
Cron Job newbie_adm Linux - Newbie 2 06-05-2006 11:52 PM
CRON Process Won't Execute Automatically Transition Linux - General 5 01-14-2005 03:51 PM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration