Download - Daemons and Cron
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 1/17
Tech Mahindra Limited confidential© Tech Mahindra Limited 2009
Daemons and Cron
Prepared by:- EMAS Cheetah
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 2/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 2
Daemons and Cron
Purpose:
In Unix environment Daemons and Cron plays a vital role.
This presentation is helpful for everyone who works in UNIXenvironment
Understanding Daemons and Cron gives Unix applicationsupport people a fine edge.
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 3/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 3
Daemons
A Daemon is a background processDaemon stands for Disk and Execution Monitor. A daemon is a long-
running background process that answers requests for services. Theterm originated with Unix, but most operating systems use daemons
in some form or another. In Windows NT, 2000, and XP, for
example, daemons are called "services". In Unix, the names of
daemons conventionally end in "d". Some examples include inetd,
httpd, nfsd, sshd, named, and lpd.
• Performs a specific system service• An NT service is similar
Some Daemons• are started at boot-time and run continuously
• are started when needed, and die when completed• are started by the kernel• are kernel code dressed up to look like daemons• will fork themselves to run in the background
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 4/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 4
init
• The Primary, critical system daemon
Common system daemons
• Paging daemon
Faults pages from disk into RAM as needed• Swapping Daemon
Moves entire processes out to disk• File system synchronization daemon
Flushes cached in-RAM disk blocks to disk
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 5/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 5
Inetd
Networking super-daemon
Starts individual daemons as needed
Listens for activity on TCP/UDP ports
Configuration files• /etc/inetd.conf on most systems• /etc/services lists TCP/UDP port name/number pairs• /etc/protocols lists protocol name /number pairs
• /etc/rpc lists remote procedure call name /number pairs
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 6/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 6
Xinetd
Enhanced Version of inetd
Used by Linux instead of inetd
Configuration files stored in directory /etc/xinetd.d
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 7/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 7
NFS Daemons
nfsd
Serves NFS filesMountd
Handles NFS file system mount requests
Lockd
Handles advisory locksStatd
Monitors status of NFS servers
Biod Caches NFS blocks – improves performance
read-ahead/write-behind
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 8/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 8
Automount Daemons
Automount Automounter daemon for autofs-based systems
Amd
AMD automounter daemon
Time Synchronization Daemons
timed Xntp
Cron
Performs periodic, scheduled tasks for users
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 9/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 9
NIS Daemons
YpbindLocates NIS servers – runs on client and server
Ypserv
Handles NIS queries – runs on all NIS servers
Ypxfrd
Transfers NIS database to slave servers
Yppasswd
Listens on master for yppasswd password change requests
Rcp.nisd
Like ypserv, but for NIS+
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 10/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 10
Boot and configuration Daemons
Dhcp
Dynamically provides IP,gateway, and name serversBootpd
Bootp daemon (precursor to DHCP)Tftpd
Trivial file transfer used for diskless bootingRarpd
Responds to reverse ARP requestsBootparamd
Assists booting of diskless clients
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 11/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 11
Cron
Cron
Actually it is called ‘cron daemon’. Cron is an automatic task
machine. You will use it on your Unix or Linux operatingsystems for doing some tasks at specific intervals with outyour intervention every time. You set the clock and forget.The cron daemon runs the work for you.
What is cron tab?‘Cron tab(CRON TABle)’ is a text file that contains a series of cron functions.
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 12/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 12
Cron (contd..)
Cron A Daemon Service that runs periodic jobs
Jobs specified in per-user configuration file – a crontab The Crontab configuration file
Lists one or more programs to run, and when to run them
one crontab file per user
The Crontab Program
The Crontab program is used to schedule jobs listed in auser’s crontab configuration file
Stores a copy of the user’s crontab in its directory
Linux: /var/spool/cron
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 13/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 13
Crontab Format
Each line contains six fields, separated by whitespace
minute || hour || day || month || weekday || command
Field Specifications:
Field Valid Values
minute 0-59
hour 0-23
Day 1-31
Month 1-12
Weekday 0-6(0=Sunday)
Command The command to be run
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 14/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 14
Crontab Format
Metacharacters
The * wildcard can be used to mean all valuesRanges can be specified using dash
x-y means x through y, inclusivelyLists of values are separated with comma’s
x,y,z means x and y and z
A comment line starts with the # character as the first character can't be used whitin line
Environment Variables
A line may specify as environment variable setting
variable = value
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 15/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 15
Cron
The Crontab Utility
The Commands
Crontab fileo Installs the crontab file into the system crontab directory
o Schedules the entries within file to run
Crontab –l
Lists the crontab for the current user
Crontab –e
Edits and re-schedules a user’s crontab
Crontab –r
Removes a users’ crontab
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 16/1708/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 16
Cron
Crontab Management
/etc/cron.allow
if it exists, specifically allows only the listed users to runcrontab
if it does not exist, everyone is allowed to run crontab
/etc/cron.deny
if it exists, the listed users are not allowed to run crontab
Editing these files do not affect existing crontabs or readyscheduled jobs
The administrator must remove the desired crontabs eithermanually or by using crontab -r
7/30/2019 Daemons and Cron
http://slidepdf.com/reader/full/daemons-and-cron 17/17
08/30/13 CONFIDENTIAL© Copyright 2009 Tech Mahindra Limited 17
Thank You