Periodic Processes Chapter 9.

Slides:



Advertisements
Similar presentations
ITR3 lecture 7: more introduction to UNIX Thomas Krichel
Advertisements

Basic Unix system administration
OpenVMS System Management A different perspective by Andy Park TrueBit b.v.
2000 Copyrights, Danielle S. Lahmani UNIX Tools G , Fall 2000 Danielle S. Lahmani Lecture 12.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 27: - The Process Chin-Chih Chang
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 8 Introduction to Printers in a Windows Server 2008 Network.
Linux+ Guide to Linux Certification, Second Edition
UNIX Processes. The UNIX Process A process is an instance of a program in execution. Created by another parent process as its child. One process can be.
Linux Operations and Administration
CHAPTER 21 Automating Jobs. Introduction to Automating Jobs DBAs rely heavily on automating jobs. DBAs cannot be effective without automation. Listed.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
System Monitoring and Automation CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.
Linux Operations and Administration
Day 8 Exporting Displays Cronjobs Mount. Chapter 5 Chapter 5 talks about X windows. –You should read the chapter. –However, you do not need to pay particular.
Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set.
ServerProtect 5.58 for NT Tech Support Dep.. Table of Contents Introduction and Installation Managing ServerProtect Configuring ServerProtect Maintaining.
System Monitoring and Automation. 2 Section Overview Automation of Periodic Tasks Scheduling and Cron Syslog Accounting.
TELE 301 Lecture 10: Scheduled … 1 Overview Last Lecture –Post installation This Lecture –Scheduled tasks and log management Next Lecture –DNS –Readings:
Linux+ Guide to Linux Certification, Third Edition
Linux Services Muhammad Amer. 2 xinetd Programs  In computer networking, xinetd, the eXtended InterNET Daemon, is an open-source super-server daemon.
Linux+ Guide to Linux Certification, Third Edition
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
1 Periodic Processes and the cron Daemon The cron daemon is where all timed events are initiated. The cron system is serviced by the cron daemon. What.
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
Chapter 3 & 6 Root Status and users File Ownership Every file has a owner and group –These give read,write, and execute priv’s to the owner, group, and.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
Periodic Processes Periodically proceed the assigned jobs in BSD… Similar the one in windows.
UNIX-21 WEEK 2 4/5/2005. UNIX-22 TOPICS Functions (contd.) pushd, popd, dirs Debugging Shell scripts Scheduling Unix jobs Job Management.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Chapter 10 Periodic Processes Unix System Administration.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
Using Crontab with Ubuntu
Backing Up Your System With rsnapshot
Project Management: Messages
CCNA Routing and Switching Routing and Switching Essentials v6.0
Chapter 9 Router Configuration (Ospf, Rip) Webmin, usermin Team viewer
Running the Operational Codes for the Brahmaputra
System Programming and administration CS 308
lctseng / Liang-Chi Tseng Edit: yench
Chapter 9 Periodic Processes
Chapter 11: Managing Users
Chapter 2: System Structures
Part 3 – Remote Connection, File Transfer, Remote Environments
LCGAA nightlies infrastructure
System Administration
Chapter 10: Device Discovery, Management, and Maintenance
CCNA Routing and Switching Routing and Switching Essentials v6.0
Assignment Preliminaries
Like tron and not kron, or chron
Chapter 10: Device Discovery, Management, and Maintenance
UNIX Services and Daemons
CE Operating Systems Lecture 21
(Chapter 2) John Carelli, Instructor Kutztown University
Linux Administration Odds and Ends
SUSE Linux Enterprise Desktop Administration
Periodic Processes.
Chapter 9 Periodic Processes
Version A.01 H3064S Module 14 Slides
Periodic Processes.
Stata Basic Course Lab 2.
Periodic Processes.
lctseng / Liang-Chi Tseng
Presentation transcript:

Periodic Processes Chapter 9

Chapter 9 - Periodic Processes Introduction The key to staying in control of your system is to automate as many tasks as possible. For example, and adduser program can add new users faster than you can, with a smaller chance of making mistakes. Almost any task can be encoded in a shell, Perl, or expect script. It is often useful to have a script or command executed without any human intervention For example, you might want to have a script verify (say, every half hour) that your network routers and bridges are working correctly and have it send you email when a problem is discovered. Chapter 9 - Periodic Processes

1. cron: schedule commands Under UNIX, periodic execution is handled by the cron daemon. cron starts when the system boots and remains running as long as the system is up. cron reads one or more configuration files containing lists of command lines and times at which they are to be invoked. The commands are executed by sh, so almost anything you can do from the shell can be done by cron. Chapter 9 - Periodic Processes

1. cron: schedule commands A cron configuration file is called a “crontab,” short for cron table. All crontab files are stored in a single system directory, where cron knows where to look for them The crontab command transfers crontab files to and from this directory. Typically there is (at most) one crontab file per user Files are named with the loginname of the user they belong to, and cron uses these filenames to figure out which UID to use when running the commands that each file contains Chapter 9 - Periodic Processes

1. cron: schedule commands Cron normally does it work silently, but some versions keep a log file. The log file grows quickly and is rarely useful Leave logging off unless you’re debugging a specific problem. Most crons do not compensate for commands that are missed while the system is down. Some do not understand daylight savings Chapter 9 - Periodic Processes

2. The format of crontab files All the crontab files on a system share a common format. Comments are introduced with a # in the first column Each non comment line contains six fields minute hour day month weekday command The first five are separated by whitespace. Whitespace in the command is taken literally Chapter 9 - Periodic Processes

2. The format of crontab files Example 1: 45 10 * * 1-5 Means 10:45 am Monday through Friday Example 2: 0,30 * 13 * 5 Means every half hour on Friday AND every half hour on the 13th, It does not mean every half hour on Friday the 13th. Chapter 9 - Periodic Processes

2. The format of crontab files The command is the sh command line to be executed It can be any valid shell command and should not be quoted. Usually any output produced by a cron command is mailed to the owner of the crontab Example: 20 1 * * * find /tmp –atime + 3 –exec rm –f {} ‘;’ What does it do? Chapter 9 - Periodic Processes

Chapter 9 - Periodic Processes 3. Crontab management crontab filename Installs filename as your crontab (replaces old file) crontab -e Checks out a copy of your crontab file and invokes your editor on it. As specified by the EDITOR environment variable crontab -l Lists the contents of your crontab file to standard output crontab -r Removes your file Chapter 9 - Periodic Processes

Chapter 9 - Periodic Processes 3. Crontab management Most systems allow root to supply a username argument so that other users crontab files may be viewed, edited, or deleted crontab –r jsmith By default, all users can submit crontab files to cron cron.allow and cron.deny allow you to override this policy It is important to note that access is controlled by crontab (not by cron), so if a user can sneak a crontab file into the appropriate directory cron will blindly execute it. Chapter 9 - Periodic Processes

4. Some common uses for cron A number of tasks are especially suited for invocation by cron. These usually make up the bulk of the material in root’s crontab Most UNIX systems often come with some crontab entries preinstalled for you. So, let’s look at some of the tasks Chapter 9 - Periodic Processes

4. Some common uses for cron Cleaning the filesystem core files Useful for software developers, but for administrators they are usually a waste of space. NFS When a file is deleted on an NFS server (but still is used remotely) it will often rename the file .nfsxxx /tmp and /var/tmp files Chapter 9 - Periodic Processes

4. Some common uses for cron Sample cron lines find / -xdev –name code –atime +7 –exec rm –f {} ‘;’ find / -xdev –atime +3 ‘(‘ –name ‘#*’ –o name ‘.#*’ –o name ‘*.CKP’ –o –name ‘*~’ –o name ‘.nfs*’ ‘)’ –exec rm –f {} ‘;’ find /var/preserve –mtime +14 –exec rm –f {} ‘;’ cd /tmp; find . ! –name . ! –name lost+found –type d -mtime +3 –exec /bin/rm –rf {} ‘;’ Chapter 9 - Periodic Processes

4. Some common uses for cron Network distribution of configuration files If you are running a network of machines, it is often convenient to maintain a single network-wide version of configuration files Examples: Mail aliases NIS Chapter 9 - Periodic Processes

4. Some common uses for cron Rotating log files UNIX log files generally grow without bound until they are manually reset. You could just truncate them at various intervals A more conservative strategy is to “rotate” log files by keeping several older versions of each one. See page 205 for more info on this. Chapter 9 - Periodic Processes

Chapter 9 - Periodic Processes 5. Vendor specifics Red Had and FreeBSD use a free version of cron called Vixie-cron Chapter 9 - Periodic Processes

Chapter 9 - Periodic Processes