1850065 Members
3168 Online
104050 Solutions
New Discussion

Scheduling cron

 
Praveen Bezawada
Respected Contributor

Scheduling cron

Hi
I want to schedule cron from a script, when I echo line into the crontabs file in /var/spool/cron/crontabs/ directory though the line is being displayed when the user does crontab -e
it does not get executed at the scheduled hour.
How should the scheduling be done.

.. praveen
6 REPLIES 6
Wodisch
Honored Contributor

Re: Scheduling cron

Hello Praveen,

very bad idea to modify the crontabs in that directory
directly! Use "crontab FILE", and that will notify "cron",
perhaps with signal HUP. "FILE" would be the name of
your new crontable, including ALL the lines - old and
new.

Everything else is almost certain to fail!!!

HTH,
Wodisch
Madhu Sudhan_1
Respected Contributor

Re: Scheduling cron

Praveen :

Try echoing into a temporary file including its previous contents then let the script have crontab /filename.

Madhu



Think Positive
Madhu Sudhan_1
Respected Contributor

Re: Scheduling cron

Praveen :

If you want to go in the same path as yours. Then try restarting the cron. It should work.

...Madhu

Think Positive
Andreas Voss
Honored Contributor

Re: Scheduling cron

Hi,

why not using

batch [startdate]

to schedule a job ?

See 'man batch'

Regards
Satish Y
Trusted Contributor

Re: Scheduling cron

Hi Praveen,

Try,

# crontab (file-name --> file in /var/spool/cron/crontabs directory or file with full path)

set variable CRON=1 in /etc/rc.config.d/cron

# /sbin/init.d/cron stop
# /sbin/init.d/cron start

Cheers...
Satish.
Difference between good and the best is only a little effort
Helen French
Honored Contributor

Re: Scheduling cron

You can automatically bring your own crontab into vi by using the crontab -e or just view it with crontab -l. When you do the -e option it should automatically notify cron to use the new file....

Anyone who knows this to be inccorect please correct me, I'm a newbie

Just the basics.

AJ
Life is a promise, fulfill it!