How do I add jobs to cron under Linux or UNIX oses?

Q. How do I add cron job under Linux or UNIX like operating system?

A. Cron job are used to schedule commands to be executed periodically i.e. to setup commands which will repeatedly run at a set time, you can use the cron jobs.

crontab is the command used to install, deinstall or list the tables used to drive the cron daemon in Vixie Cron. Each user can have their own crontab, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly. You need to use crontab command for editing or setting up your own cron jobs.

To edit your crontab file, type the following command:
$ crontab -e

Syntax of crontab

Your cron job looks like as follows:
1 2 3 4 5 /path/to/command arg1 arg2

Where,

  • 1: Minute (0-59)
  • 2: Hours (0-23)
  • 3: Day (0-31)
  • 4: Month (0-12 [12 == December])
  • 5: Day of the week(0-7 [7 or 0 == sunday])
  • /path/to/command - Script or command name to schedule

Same above five fields structure can be easily remembered with following diagram:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

Example(s)
If you wished to have a script named /root/backup.sh run every day at 3am, my crontab entry would look like as follows:
(a) Install your cronjob:# crontab -e(b)Append following entry:0 3 * * * /root/backup.shRun five minutes after midnight, every day:5 0 * * * /path/to/commandRun at 2:15pm on the first of every month:15 14 1 * * /path/to/commandRun at 10 pm on weekdays: 0 22 * * 1-5 /path/to/command Run 23 minutes after midnigbt, 2am, 4am ..., everyday:23 0-23/2 * * * /path/to/commandRun at 5 after 4 every sunday:5 4 * * sun /path/to/command

Use of operators

An operator allows you to specifying multiple values in a field. There are three operators:

  1. The asterisk (*) : This operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month.
  2. The comma (,) : This operator specifies a list of values, for example: "1,5,10,15,20, 25".
  3. The dash (-) : This operator specifies a range of values, for example: "5-15" days , which is equivalent to typing "5,6,7,8,9,....,13,14,15" using the comma operator.

How do I disabling Email output?

By default the output of a command or a script (if any produced), will be email to your local email account. To stop receiving email output from crontab you need to append >/dev/null 2>&1. For example:0 3 * * * /root/backup.sh >/dev/null 2>&1To mail output to particluer email account let us say vivek@nixcraft.in you need to define MAILTO variable to your cron job:MAILTO="vivek@nixcraft.in"
0 3 * * * /root/backup.sh >/dev/null 2>&1

Task:To list your crontab jobs use the command

Type the following command:# crontab -lTo remove or erase all crontab jobs use the command:# crontab -r

Use special string to save time

Instead of the first five fields, you can use any one of eight special strings. It will not just save your time but it will improve readability.

Special string Meaning
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".

Run ntpdate every hour:
@hourly /path/to/ntpdate
Make a backup everyday:
@daily /path/to/backup/script.sh

Understanding /etc/crontab file and /etc/cron.d/* directories

/etc/crontab is system crontabs file. Usually only used by root user or daemons to configure system wide jobs. All individual user must must use crontab command to install and edit their jobs as described above. /var/spool/cron/ or /var/cron/tabs/ is directory for personal user crontab files. It must be backup with users home directory.

Typical /etc/crontab file entries:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

Additionally, cron reads the files in /etc/cron.d/ directory. Usually system daemon such as sa-update or sysstat places their cronjob here. As a root user or superuser you can use following directories to configure cronjobs. You can directly drop your scripts here. run-parts command run scripts or programs in a directory via /etc/crontab

Directory Description
/etc/cron.d/ Put all scripts here and call them from /etc/crontab file.
/etc/cron.daily/ Run all scripts once a day
/etc/cron.hourly/ Run all scripts once an hour
/etc/cron.monthly/ Run all scripts once a month
/etc/cron.weekly/ Run all scripts once a week

How do I use above directories to put scripts?

Here is a sample shell script (clean.cache) to clean up cached files every 10 days. This script is directly created at /etc/cron.daliy/ directory i.e. create a file called /etc/cron.daily/clean.cache:

 #!/bin/bash
CROOT="/tmp/cachelighttpd/"
DAYS=10
LUSER="lighttpd"
LGROUP="lighttpd"
 
# start cleaning
/usr/bin/find ${CROOT} -type f -mtime +${DAYS} | xargs -r /bin/rm
 
# if directory deleted by some other script just get it back
if [ ! -d $CROOT ]
then
        /bin/mkdir -p $CROOT
        /bin/chown ${LUSER}:${LGROUP} ${CROOT}
fi
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 78 comments… read them below or add one }

1 umesh 08.30.06 at 6:10 am

hi
i want to mail for few members for every 15 mintes .i have worte php script stored as mail.php i want to set cronjob . i don’t no how to set corn commad or path i am useing cpanel
can u help me

2 nixcraft 08.30.06 at 6:41 pm

Type crontab -e command:
crontab -e

Append following job:
15 * * * * /path/to/script.php

Save and close the file.

3 David W. Jensen 12.27.06 at 2:45 am

Using Puppy Linux at the moment. How does one check to see if the cron daemon is running.?
I have a file that works from the command line.
“/home/dwj/CRONY/cronf.01″ which simply makes a statement on the monitor screen. I want cron to be able to put a variety of messages on the monitor screen at various times through the day & week. [ A separate file for each message of course.]
But so far nothing I had tried works. In /var/spool/cron/crontabs/dwj [ my crontab file which was created using Puppy's GUI 'gcrontab' within their control panel, bottom selection.].
The items in the fields look correct to me vis:
“01-59/6 * * * * /home/dwj/CRON/cronf.01″

Which is supposed to mean from minute 01-59 each
6 second interval = do the file in field #-6.
What else am I missing or do not understand.?

TIA for any & all help rendered.

Dwj 73 w 0 r m v LONG LIVE LINUX

4 nixcraft 12.27.06 at 8:46 am

David,

Crontab is designed to work with minutes and upwards it cannot wake up and run task every second or every 6 second later. cron is not really
designed for such frequent runs.

You need to start your script in background
/home/dwj/CRON/cronf.01 &

in script put logic as follows
while [ true ]; do
sleep 6
# add rest of commands
Done

5 JDS 01.05.07 at 4:00 pm

The response to “how to run every 15 minutes” is wrong. The answer given:

15 * * * * /path/to/script.sh

will run the thing every hour, at the 15 minute mark. (9:15, 10:15, etc)

The proper answer is:

0,15,30 * * * * script.sh

or

0-59/15 * * * * script.sh

(depends on your version of cron)

6 zane matthew 01.26.07 at 4:00 pm

thanks for the help, im at working installing mrtg and setting up my crontab files for the first time

7 ashish 02.20.07 at 7:09 pm

why doesn’t crontab work for me .
the crond is running bbut what i want is not happening
/var/spool/cron is unreadable
also crontab -l correctly lists what I want
35 * * * * /usr/bin/gedit

8 ashish 02.20.07 at 7:13 pm

even at does nothing for me
atd is running

9 ashish 02.20.07 at 7:14 pm

even at does nothing for me
atd is running
and when I press atq it lists the time and everything
but when the time comes the atq displays nothing

10 vengadesh 03.14.07 at 9:06 am

I have a question , How to run Cron for 5 seconds.please advice me .Reply fast

11 rocky 03.16.07 at 8:36 am

vengadesh,

You can’t uss crond for seconds

12 Tarachand 03.20.07 at 5:04 am

hi

I want to fire cron job at the interval of every 10 minutes, how to write entry in crontab.

regards

Tarachand

13 George 03.22.07 at 1:35 pm

Is it possible to have cron run something on the second Saturday of the month? Also, is it possible to have cron run somthing 2 days prior to the end of each month?

14 Jeremy Hannah 03.23.07 at 8:29 pm

Does the cron job have to reside in /var/spool/cron/crontabs, or can the cronjob reside anywhere?

15 nixcraft 03.24.07 at 4:55 am

Jeremy,

Yup it is the default location under /var file system. You can change this location by recompiling software.

16 Aravind Miryala 04.07.07 at 3:32 pm

I want to schedule cron jobs for First Saturday of Every MOnth. Your help is appreciated

17 nixcraft 04.07.07 at 9:53 pm

Aravind,

You need to write a smart script that will detect First Saturday of Every Month as you can not write such cron job. You can also try following trick:
00 01 1-7 1-12 * if [ "$(date +%a) = "Sat" ]; then /path/to/script.sh; fi

Add additional logic in /path/to/script.sh to detect First Sat of each month.

18 Valli 04.19.07 at 2:42 pm

What does 00 14 29 12 4
mean?

19 John T. 04.19.07 at 7:28 pm

Vali,

# Use the hash sign to prefix a comment
# +—————- minute (0 – 59)
# | +————- hour (0 – 23)
# | | +———- day of month (1 – 31)
# | | | +——- month (1 – 12)
# | | | | +—- day of week (0 – 7) (Sunday=0 or 7)
# | | | | | +- command to be executed
# | | | | | |
# * * * * * command
0 14 29 12 4 /path/to/command

command will be run at 2pm Dec 29th in addition to every Thursday in December I believe.

20 Lakshmi Shastry 04.26.07 at 7:44 am

I need to write a cron expression which fires every 5 hours from the given start time. Ex:- If 8.30 am is my start time then the cron expression will be something like “30 8,0-23/5 * * *”. But this fires in the time sequence like at 8.30, 10.30, 15.30, 20.30, 00.30, 10.30 etc…
But what i need the time sequence is 8.30, 13.30, 18.30, 1.30, 6.30, 11.30, 16.30, 21.30, 2.30… which means that fire should occur for the specified start time and every 5 hours after that. Can anyone help me with the cron expression to represent the same. Thanks a lot in advance.

21 vinod 04.27.07 at 3:24 pm

i hope
30 1-23/5 * * * /aaa.sh
will work

22 GC Hutson 05.26.07 at 9:18 pm

Since CRON cannot be used to schedule tasks by the second, what can be used/written/done to perform tasks as such?

23 Ap_1 05.30.07 at 5:35 am

Hi,
I added 1 enrty in crintab using crontab -e,i added below line in that file
0 23 * * 1-5 root echo “I will run at 11″

but after 11:00 clock also its not running….
y any idea ???

I checked,Cron shell is running……then y that command didnt run..
Plz help regarding this

24 Johan 08.15.07 at 6:06 pm

Hello,

When i try to run crontab i get the following error message “failed user root parsing”.

And the cron is not executing anything.

The command crontab -l indicates that everything is fine and that i have scheduled a command correctly.

Also checked that the service is running “crond”

cant get cron to work please help!

I am using Puppy linux 2.16

Thanks for help, my email is: Johan@mediavisiongroup.se

25 Ivan Versluis 12.19.07 at 10:22 am

Thank you. I needed some help on scheduling my ntpdate in a virtual linux machine.

26 vasanthan 01.17.08 at 2:53 pm

problem with setting cronjob..

i woud like to kow how to run a mail.php
file everday..on my server..5 0 * * * /path/to/command..the thing is i dont know the
command ..please help me..

27 lalith 01.18.08 at 10:55 am

Can any one help me iam using Debain 3.0 server when iam setup a file for cron job,it was not working.

28 sateesh 01.18.08 at 11:40 am

we can use */15 * * * * cmd also to run every 15 minutes

regards.
sateeshlinux.blogspot.com

29 neo 01.21.08 at 10:36 am

Hi,
My cron manage to execute at the desired time but the email i received is “permission denied”. I copy and paste the message below

“/bin/sh: /usr/bin/lynx: Permission denied”

The cron command is as follows :-

lynx -dump http://myurl.com/cgi-bin/autoresponder/activate.cgi

What it does is to log in toe activate.cgi at certain time of the day. By typing the url manually will require a password first and the command is executed.

Is this the problem that cause the permission denied ? If this is the case – how can i incorporate the password in the cron command line ?

Hope you can assist.
Thanks.

30 Shashi 02.28.08 at 4:34 pm

What is the meaning of this?

30 1 * * * /home/clean_parse_logs.sh >> /home/logs/clean_parse_logs.log 2>&1

31 thegetpr 03.12.08 at 12:51 pm

how i can start a crownjo for a life time
very minute every second every day, week ,month and year

32 venki 03.12.08 at 1:55 pm

i can’t say abt seconds.
* * * * * script

this will run the script for every min,hour,day,month,year.

33 rogier 03.13.08 at 10:13 pm

Hi there,

I want to execute a php file on my webserver (non-unix). I do have a unix server and I want to execute Insert.php on my non-unix server from my unix server.

Is that possible?
What do I exectly need to type?
And is it possible to give an URL instead of a normal Path?

thanx,

Rogier

34 thegetpr 03.20.08 at 10:34 pm

my crown job is working fine ***** script
but its execution time is very slow, how should i make it fast to work

35 Nilesh 03.21.08 at 1:34 am

Use fcron; which doesn’t wake up every minute to see whether there is a job to be executed. It sees the next time when to wake up and wakes up at the particular time only unless a user edited his fcrontab to wake it up before. It saves resources. The syntax is quite similar but there is some difference which can be learnt by using.

http://fcron.free.fr

it is available in fedora’s repos.

36 pravin 03.31.08 at 11:16 am

how do i append new task or crontab job using scprite in existing task

37 Rajitha 05.13.08 at 6:52 am

submitting the job in crontab is a bit confusing for the beginners.

in a text file(eg., file.txt) give all the cron jobs you want to schedule
eg., 15 14 * * * /root/dir/script.sh

and submit the file using crontab
crontab file.txt

in order to do this user need to have permisson, which can be seen using cron.allow file

if the crontab file is already existing use crontab -e to add ur job to the crontab.
if it is already existing crontab -l displays the existing jobs

one imp thing to remember is you need to provide all absolute paths in the script which u want to schedule, otherwise u will end up in thinking why my cron job is not running though it is added properly.

38 Hans 05.15.08 at 9:28 pm

Nice tutorial,

To be complete it would be nice to mention:
/etc/cron.daily
/etc/cron.hourly
/etc/cron.deny
/etc/cron.monthly
/etc/cron.weekly
/etc/cron.d

As these are preferred afair

39 vivek 05.16.08 at 1:05 pm

Hans,

The faq has been updated.

40 lalit 06.20.08 at 6:41 am

Hi
I’m new in solaris.I want to create a cron job to delete a temp file in a directory and it run on every saturday of the week.

I have created a cron job as cron.txt.
0 12 19 6 4 rm /temp/*
Where will upload it?
How to run it?
.

41 Rafiuddin 07.29.08 at 10:37 am

To remove or erase all crontab jobs
command:# crontab -r

Instead of -e as mentioned in the tutorial……

42 vivek 07.29.08 at 11:32 am

Rafiuddin,

Thanks for the heads up. The faq has been updated.

43 Amjad 08.23.08 at 12:26 pm

Thank You aLot, It’s help full answer

44 rptirore 09.23.08 at 5:53 am

good one!

45 Rupo 10.07.08 at 8:54 am

Is it possible to set up cron so that once it started, it will run 7 minutes later, then 3 minutes later, and then 7 minutes later i.e. running twice every 10 minutes

46 Ben 11.25.08 at 2:35 am

Is the eight special string suitable use for all type/version of linux operating system? (eg.Red-hat, Ubuntu)

Example:
Special string Meaning
@reboot Run once, at startup.
@yearly Run once a year, “0 0 1 1 *”.
@annually (same as @yearly)
@monthly Run once a month, “0 0 1 * *”.
@weekly Run once a week, “0 0 * * 0″.
@daily Run once a day, “0 0 * * *”.
@midnight (same as @daily)
@hourly Run once an hour, “0 * * * *”.

47 vivek 11.25.08 at 6:38 am

Ben

Yes, they works with Linux / UNIX as long as your are using Paul Vixie’s crond.

48 Ben 11.25.08 at 9:43 am

Thank you a lot. it is help me a lot.

49 Subeesh 12.09.08 at 8:12 am

Hi,
I want to run a script – everyday 12:00 am – 01:00 pm every 5 minutes,
Please help me
Thanks,
Subeesh

50 karthikesan 12.12.08 at 3:02 pm

Hi
I want to run hourly job.
The script :
$userp=`du -cskh /path/ |sed -e ‘G//g’`
ALERT=90
$st=echo”if($userp > $ALERT) 1 |bc ”

when i run this .The cron is giving me a error like use test and at this line iam getting error
like teletype (u can’t use this option -c -h).
1)crontabs -e
2)Cronjob
********
5 * * * * /path/scripts
Please help me
Thank
kathi

51 Nayibe 12.16.08 at 6:42 pm

I need to set up a cron that runs a script every other Friday.

52 Harrel 01.02.09 at 9:27 am

I want to add a cronjob or the following cron command

/usr/bin/php -f /homepages/33/d249180215/htdocs/iem/admin/cron/cron.php

I entered
*****/usr/bin/php -f /homepages/33/d249180215/htdocs/iem/admin/cron/cron.php

in ssh via putty
but it’s giving error like pattern not found: usr

Can anyone help? I use 1and1 hosting.

53 Ramit 01.09.09 at 12:19 am

This is not working. What is wrong
MAILTO=”4085298665@txt.att.net”
0 3 * * * /root/backup.sh >/dev/null 2>&1

54 SHEETAL.A 01.09.09 at 5:24 am

hi,

I want to use cron job for backups. I am using suselinux 9.0

55 googleguy 02.21.09 at 5:44 pm

Well
3**** /path/to/command
means to run command every 3rd minute of every hour not every 3 mins ……..
understand this diff………to make it run every 3mins we have to do
*/3****/path/to/command
And to add php file to crontab add #!/usr/bin/php //this in to php file
and also to crontab file .(property of file and folder shd be rwx );

56 Download Free Photos 02.24.09 at 12:05 pm

Many thanks, it’s help me a lot.

57 amit 03.25.09 at 9:21 am

Hi,
I put following in a file named ‘cronjob’ in the /etc/cron.d
*/5 * * * * root /etc/cron.d/script.sh >> /opt/cronjobs/cron.log
but dont see any thing happening. Pls suggest
Thanks

58 maaly 03.26.09 at 9:15 pm

write echo command that print “hello” message on o
every day at a 2 am at the morning for the first week of the month

59 Subeesh 04.02.09 at 6:27 am

Hi all,
I want to write cron to run a script from 12 noon to 11:30 pm, every 5 minutes
I have written like this, which I guess, it works from 12 noon to 11 PM only,
0-55/5 12-23 * * * /path/to/command
but how should I re-write it to run the script from 12 noon to 11:30 pm, every 5 minutes ?
Thanks in advance,
Subeesh

60 Haid Avila 04.22.09 at 2:28 am

Hi, I´ve just made my script and put it into crontab…
I want my script to run this command ( opensipsctl fifo lb_resize 1 pstn 0) if ping fails.
It looks like this…

#!/bin/bash

# add ip / hostname separated by while space
HOSTS="192.168.0.11"

# no ping request
COUNT=1
 for myHost in $HOSTS
do
  count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
  if [ $count -eq 0 ]; then
    # 100% failed
    opensipsctl fifo lb_resize 1 pstn 0
  fi
done

If I run the script from the command line it works nice and smooth, but if it runs from the CRON it doesn´t work

I have this on my crontab so it will run every minute

0-59 0-23 * * * /etc/opensips/monitor_server1.sh

If I look at my LOG, my CRON call it
Apr 21 21:25:01 [cron] (root) CMD (/etc/opensips/monitor_server1.sh )

But it doesn´t work…

Any idea?
Regards!

61 Vivek Gite 04.22.09 at 6:21 am

Use full path names in cron jobs.

62 Haid Avila 04.22.09 at 5:47 pm

Thanks for your advise Vivek

Regards!

63 dinesh 06.02.09 at 10:31 am

hi
i wnt to know how i can schedule backup though crontab.
please send a particular script to me on my {snip_no_email_ids}

64 dinesh kumar midha 06.02.09 at 10:40 am

i hv used hints for tunning (max hints was orders )
now i m running the report but it is not work
ora-01652 unable to extend temp segment by 128 in tablespace temp

i have added new datafile or resize also but it is not working
if u hv any idea plz give the solution

65 MsfStl 06.16.09 at 2:41 pm

I have a cron job with multiple jobs listed at various times throughout the day.

I have two questions:

1) For each job, is it possible to reset the MAILTO statement to a different user? (E.g., Cathy is a user for a cron job that runs at 11:30 PM every day, her cron job is:
30 23 * * * /usr/local/bin/sas -noterminal /users/adrc/cathy/imaging/makedata.sas &
Scot is a user of a cron job that runs at 2:39 AM every day, his cron job is:
13 2 * * * /usr/local/bin/sas -noterminal -sysin /users/adrc/scot/sas_program
s/batch_scripts/hpdabat.sas & )
So is it possible to set a MAILTO= Cathy@domain.com prior to her cron job and then set another MAILTO=Scot@domain.com for his cron job?

2)While my cron jobs work, I have been receiving the following failed message:
/bin/sh:
: command not found

Any ideas what could be causing this?

Thanks for your time.

66 Vivek Gite 06.16.09 at 3:16 pm

1) For each MAILTO add cronjob to users account and not to root users account. Run:

crontab -e -u cathy

2) /bin/sh is not installed hence you see the error. A

67 amol 06.21.09 at 4:53 am

I have added following script to crontab , but it fails to execute at Schedule time

00 0,2,4,6,8,10,12,14,16,18,20,22 * * * [ -x /usr/local/SAN/rcomsapp40db/rcomsapp40db] && /usr/local/SAN/rcomsapp40db/rcomsapp40db

Other scripts/cronjobs with same syntax are working fine.

Any ideas what could be causing this?

68 MsfStl 06.22.09 at 2:02 pm

Thank you, Vivek.

I now have the Mailto working.

However, now instead of the fail message “: command not found”, I get a null fail message. Basically, it’s just an email stating the cron job failed, but nothing in the message. Just blank.

I appreciate any help in correcting this.

Thanks,

Scot

69 Vivek Gite 06.22.09 at 3:03 pm

Make sure you have correct PATH settings set for your contab. Also, use full path when run jobs via crons.

70 MsfStl 06.22.09 at 3:15 pm

Thanks again Vivek. I believe I found out what was going on. I had the following job scheduled:

17 2 * * * /usr/local/bin/sas -noterminal -sysin /users/adrc/scot/sas_programs/batch_scripts/hpdabat.sas 2>&1 | mail -s “RE: Scot HPDA Cron Fail” scot@xxxxxx.edu

What was happening (and this is where my inexperience comes in) is that the code “2>&1 | mail – s….” was set to send an email everytime the job ran with the subject line ” RE: Scot HPDA Cron Fail”. I was piping that to run everytime (I thought it would only send if it failed.) The “2>&1″ code basically states that the email include a standard error message, if there is one, along with any other message. Since there was no error message the code did what I told it to and sent me an email called “RE:Scot HPDA Cron Fail” with nothing in it. The job works as it should. I have decided to remove the mail code and just let it do it’s thing.

Thanks again,

Scot

71 Vivek Gite 06.22.09 at 3:38 pm

Good.

Or you can add mailing code in your script itself:

[ $? -ne 0 ] && mail -S “blah” blah@exampl.com

72 Rituparna 06.23.09 at 9:13 am

Hi
I ‘m trying to schedule a batch job that will show the disk space occupied of my present working directory at every 15 minutes daily from 2:15pm for the month of June and the output will be mailed to my email id.

the script is as follows

crontab -e

15 14 6 * * //df -h

saving the file with myfile.txt and then when i type crontab myfile.txt an error comes up saying
“myfile.txt”:1: bad minute
errors in crontab file, can’t install.

73 Rituparna 06.23.09 at 9:15 am

just a bit of modification to the above
it is 15 14 6 * * //df -h

74 Rituparna 06.23.09 at 9:17 am

just a bit of modification to it
15 14 6 * * //df -h

75 Narendra 06.29.09 at 5:52 am

Hi,
How can we call php page from CRONTAB in every 5 seconds. I had used this by using sleep funtion with some logic. Script executes for a time and sleeps for 5 seconds for 10 times within 1 minute interval. But the problem occurred is sever gets too busy when I called crontab file like this.
So I would like to know how can file be executed in every 5 seconds without any problem?

76 nami 06.30.09 at 5:27 am

does all the files in /etc/cron.daily folder on a daily basis.
Actually i have copied a sh file in this folder yesterday but it did not get executed .
As if this file is executed one of my tables in the database gets updated.
I am not sure whats going wrong

77 nami 06.30.09 at 7:21 am

According to this link the files under /etc/cron.daily should get executed….
But in my case its not getting executed
i used putty to copy the file from one of the directories in the system to the /etc/cron.daily directory….
Would some permissions be causing it to not execute it.
http://www.debian-administration.org/articles/56

78 nam 06.30.09 at 8:16 am

This link specifies all the files under this directory will be executed daily…
http://www.debian-administration.org/articles/56
But in my case it is not executing is it some permission issue
my crontab file looks like below :

//////crontab////////////////
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

//////crontab////////////////

There is no cron.allow file.The cron.deny file does not contain anything.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , ,

Previous post: FTP Connection refused error – Solution to problem

Next post: How do I Compare two files under Linux or UNIX?