LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cron / anacron / fcron (https://www.linuxquestions.org/questions/linux-general-1/cron-anacron-fcron-8508/)

Will 11-09-2001 12:37 PM

cron / anacron / fcron
 
Ok, I have no idea how to make them work?

Cron: seems to be for machines that are expected to have a constant uptime.

Anacron: seems to be for machines that do not have a constant uptime but actions are carried out in n day's.

fcron: seems to fit the above 2.

Can fcron make the other two obsolete?

Sorry the main question:

I have tried all three but can't seem to get them to work. from what I can understand fcron is the one I need.

1. I need to have mozilla start at 00:01 every night.
2. I need to disconnect from the net pppd at 0800 every morinig.

Could you show me an example of what files to edit, add and where so that it works?

phek 11-09-2001 02:06 PM

ok i'm not sure what anacron or fcron are, but i'm pretty sure they all use the same old crontab

basically with cron you want to create a new file, which crontab will open up a vi session for you with the -e option, and in this file you would want to put the following sytanx
minute hour day month dayofweek command

crontab -e
and now you should have an open vi session, now in here you would add the following:
1 0 * * * mozilla #or whatever the command is to open mozilla
0 8 * * * pppd -disconnect #or whatever the command is to disconnect


basically the first says, on the first minute of the 0 hour (00:01), every day, of every month, no matter what day of the week it is, open mozilla.
same with the second except its 8am on the hour.

now save the file and you have your crontab, to view your current crontab, do crontab -l

Will 11-09-2001 02:16 PM

Yep that's the same syntax i've been using (thats a relief)

But what do I do with the file, Where do I save it?

Do I have to do anything else?

phek 11-09-2001 02:34 PM

if you do crontab -e it will automatically pick out the path and filename to save it to, just dont change it when you try to save, with slack, it saves it to /var/spool/cron/crontab.#### those are actually some form of numbers, but, later i believe it moves it to /var/spool/cron/crontab/<username>, just save the file to the default location and it will run.

you should make sure you have crond running though. do a
ps -ax
and you should see it there, if not run
crond -l10
the -l10 is log level 10, or debug and put it in your rc.local (may be different for other distro's than slackware.
crond checks the crontab file once a minute to see if it should execute a job, if so it executes, if not it sleeps till the next minute.


All times are GMT -5. The time now is 06:45 AM.