Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm completing a homework assignment on cron. I've used cron and crontabs before to schedule a weekly virus check with clam. There are two tasks that are ambiguous to me. Can someone please explain them?
1. list all system files used by cron. - I've been through all the cron folders in /etc/ (cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly). cron.daily is the only folder with multiple scripts such as 0anacron, cups, logrotate, mlocate.cron, prelink, and so on. Are these the system files the task is asking for?
2. Identify the daemons associated with cron and running on the system. It says to capture the info on the daemons using ps command. - Where I'm confused is that there is no crontab for root. /var/spool/cron is empty so I feel like cron isn't running nor are there any daemons associated with it.
I'm completing a homework assignment on cron. I've used cron and crontabs before to schedule a weekly virus check with clam. There are two tasks that are ambiguous to me. Can someone please explain them?
1. list all system files used by cron. - I've been through all the cron folders in /etc/ (cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly). cron.daily is the only folder with multiple scripts such as 0anacron, cups, logrotate, mlocate.cron, prelink, and so on. Are these the system files the task is asking for?
2. Identify the daemons associated with cron and running on the system. It says to capture the info on the daemons using ps command. - Where I'm confused is that there is no crontab for root. /var/spool/cron is empty so I feel like cron isn't running nor are there any daemons associated with it.
Thanks,
Chris
As the 'man cron' states that the deamon executes scheduled commands;
cron - daemon to execute scheduled commands (ISC Cron V4.1)
SYNOPSIS
cron [-l load_avg] [-n]
DESCRIPTION
Cron should be started from /etc/rc or /etc/rc.local. It will return immediately, so you don't need to start it with '&'. The -n option changes this default behavior causing it to run in the foreground. This can be useful when starting it out of init.
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; crontabs found are loaded into memory. Cron also searches for /etc/crontab and the files in the /etc/cron.d directory, which are in a different format (see crontab(5)). Cron then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists).
Additionally, cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified. Note that the Crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.
By looking at the '/var/spool/cron/crontabs/root' you can get some good examples.
Quote:
'/var/spool/cron/crontabs/root';
If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We'll do this here since these jobs should run
# properly on a newly installed system, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
Your ''/etc/'; cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly files within the directory are used to simplify your placement of scripts to be performed at the scheduled time. As I said 'script' is used to do your placement of the desired commands within the cron.schedule job desired. You will have cleaner operations by calling a script within the cron.schedule job.
I would suggest that you approach your instructor with your question(s). That way he/she can aid in the area of concern.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.