Hi,
I need to schedule a script in crontab which should run at 01:00 am in the morning and should run for every 15 days in a month.
How to schedule this by using crontab?
Many thanks.
Rgds,
Hi,
I need to schedule a script in crontab which should run at 01:00 am in the morning and should run for every 15 days in a month.
How to schedule this by using crontab?
Many thanks.
Rgds,
I believe most crontabs would accept:
0 1 1-15 * * /path/to/script
This would run on the first 15 days of a given month at 1am.
(I presume this is correct - your definition of "every 15 days a month" is slightly ambiguous)
Thanks citaylor!!!
I mean to ask the script should run once in a fortnight( twice in a month ) at 1am.
Rgds,
0 1 1,15 * * /path/to/script
This will run on day 1 and day 15 of the month
thanks citaylor
HI Citaylor,
Path/to/script means exat how it works .i am new to cron....
I tried lot of times but it doesnt working
i tried 0 1 * * * /home/cnu/pgm.sh..
------------
but it was showing 0 :command not found...
The underline should me problem seems...pwd is /home/cnu...
Many Thnaks In Advance
Sree Vasu
what's the output, can you see the file under /home/cnu?
ls -l /home/cnu/pgm.sh
Thanx for ur post Rd
pwd is /home/cnu...then ls -l showing pgm..
But ls -l /home/cnu/pgm.sh is showing ..............
ls: cannot access /home/cnu/pgm.sh: No such file or directory
What can i do............ can u explain me how crontab runs for perticular pgm r file...plzzzzzzzzzz
Many Thanks in advance
Rds,
Sree vasu
I think you need to read up on the "crontab" command.
Your Systems Administrator needs to allow you account to use the "crontab" command. By default no account except the "root" account can use the "crontab" command.
As an overview, the scheduling line(s) are held in a file in strict "crontab" format and then published with the "crontab" command.
Judging from the error message you posted, you are typing the scheduling line at the command prompt. This is not the correct method.
Thanx Methy,
Can u tell me the correct method step by step How to scheduling a script using Crontab.
Many Thanks In Advance,
Sree Vasu
---------- Post updated at 04:34 AM ---------- Previous update was at 03:42 AM ----------
YA under /home/cnu
file is there but still i am getting this errror...
Zzzzzzzz is a character sequence-symbol recognized as sleeping.
Lazy is associated with sleeping.
Even without that clue, your post is a recognized symbol of laziness.
There are plenty of good tutorials in the net, so many in fact, that even a search impaired person would have no trouble at all, hitting results.
I have some problem which is related to this thread,
I have a script which should be executed on last day of every month.
for which I am using the following crontab command.
30 00 * * * [ `/usr/bin/date +%d` -eq `echo \`/usr/bin/cal\`|/usr/bin/awk '{print $NF - 6}'` ] && /usr/bin/sh /infiles/tmp.sh
when I execute the following at command prompt , it executes fine
[ `/usr/bin/date +%d` -eq `echo \`/usr/bin/cal\`|/usr/bin/awk '{print $NF - 6}'` ] && /usr/bin/sh /infiles/tmp.sh
But when I schedule the same in the crontab It is throwing the following error after executing the cronjob.
Your "cron" job executed on dev on Tue Feb 22 00:21:00 CST 2011
[ `date +%d` -eq `echo `cal` | awk '{print $NF - 6}'` ] && sh /infiles/tmp.sh
produced the following output:
sh: 0403-057 Syntax error at line 1 : `|' is not expected.
Thanks,
Sekhar.
@sekhar gajjala
Your main problem is caused by the "%" sign in the crontab line which has special meaning to cron (it becomes a newline unless escaped). See "man crontab".
It will be easier to read if you place the commands in a script and then execute the script from cron.
Ps. Please open a new thread in future.
Thanks Methyl.
It worked when I embeded my command in a script and then scheduled the script.
Thanks,
Sekhar.