SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.

Slides:



Advertisements
Similar presentations
Basic Unix system administration
Advertisements

Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
Chapter 13 Processes. What is a process? A process is a program in execution A process is created whenever an external command is executed Whenever the.
Process Management We studied process management in chapter 4 – Here, we examine managing processes from a user’s and system administrator’s perspective.
Linux+ Guide to Linux Certification, Second Edition
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
CS 497C – Introduction to UNIX Lecture 27: - The Process Chin-Chih Chang
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 1 Introduction to Managing the SUSE Linux Enterprise Server.
Linux+ Guide to Linux Certification, Second Edition
Getting Started with Linux: Novell’s Guide to CompTIA’s Linux+ (Course 3060) Section 2 Use the Linux Desktop.
Linux Operations and Administration
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
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.
SUSE Linux Enterprise Desktop Administration Chapter 1 Install SUSE Linux Enterprise Desktop 10.
Linux Filesystem Management
ITIS 2110 Class # No home network devices devices devices devices devices devices devices 9.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
11 SYSTEM PERFORMANCE IN WINDOWS XP Chapter 12. Chapter 12: System Performance in Windows XP2 SYSTEM PERFORMANCE IN WINDOWS XP  Optimize Microsoft Windows.
SUSE Linux Enterprise Desktop Administration Chapter 12 Administer Printing.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
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
SUSE Linux Enterprise Desktop Administration Chapter 14 Customize the Graphical Interface on SUSE Linux Enterprise Desktop 10.
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
Linux+ Guide to Linux Certification, Third Edition
Linux Operations and Administration
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
SUSE Linux Enterprise Desktop Administration Chapter 6 Manage Software.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
Linux Introduction What is Linux? How do you use it?
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
RH030 Linux Computing Essentials
The kernel considers each program running on your system to be a process A process lives as it executes, with a lifetime that may be short or long A process.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
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.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Core System Services. INIT Daemon The init process is the patron of all processes. first process that gets started in any Linux/ UNIX -based system.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
Optimizing Windows Vista Performance Lesson 10. Skills Matrix Technology SkillObjective DomainObjective # Introducing ReadyBoostTroubleshoot performance.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 9 Working.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
Linux+ Guide to Linux Certification, Second Edition
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
Processes Todd Kelley CST8207 – Todd Kelley1.
Materi managing user & groups, file system Managing Software Packages and File Systems The Complete Guide to Linux System Administration Chapter 10.
The Linux Kernel About 6 million lines of code
Chapter 6: Managing Processes
SYSTEM ADMINISTRATION PART I by İlker Korkmaz and Kaya Oğuz
Chapter 11 – Processes and Services
SUSE Linux Enterprise Desktop Administration
The Linux Command Line Chapter 10
SUSE Linux Enterprise Desktop Administration
Lab 6: Process Management
Linux Filesystem Management
Presentation transcript:

SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services

SUSE Linux Enterprise Server Administration (Course 3037)2 Objectives Manage Processes Describe Startup Shell Scripts and Services Schedule Jobs Use System Logging Services

SUSE Linux Enterprise Server Administration (Course 3037)3 Manage Processes Objectives –Process Definitions –Jobs and Processes –How to Manage Foreground and Background Processes –How to Prioritize Processes –How to End a Process –Processes and Services (Daemons) –How to Manage a Daemon Process

SUSE Linux Enterprise Server Administration (Course 3037)4 Process Definitions Program –Structured set of commands stored in an executable file Process –Program that is running in memory and on the CPU User process –Process launched by a user that runs from a terminal Daemon process –System process that is not associated with a terminal

SUSE Linux Enterprise Server Administration (Course 3037)5 Process Definitions (continued)

SUSE Linux Enterprise Server Administration (Course 3037)6 Process Definitions (continued) init daemon –Launches other daemons (daemon processes) BASH shell –Lets user start processes manually (user processes) –Process ID Unique identifier assigned to every process –Child Process Process that is started by another process –Parent Process Process that starts other processes –Parent Process ID (PPID)

SUSE Linux Enterprise Server Administration (Course 3037)7 Process Definitions (continued)

SUSE Linux Enterprise Server Administration (Course 3037)8 Jobs and Processes Job identifier (job ID) –Shell-specific numeric value that identifies the running program –Used to refer to processes when using commands –Use job ID to switch a process from background to foreground Process ID –Unique across the entire system –All jobs have a PID But not all processes have a usable job identifier –Use PID to change priority level of a running program

SUSE Linux Enterprise Server Administration (Course 3037)9 How to Manage Foreground and Background Processes Processes executed in the foreground –Started in a terminal window –Run until the process completes –Terminal window does not return to a prompt Until the program’s execution is complete Processes executed in the background –Terminal window returns to a prompt Before the process finishes executing Processes can be switched from foreground to background

SUSE Linux Enterprise Server Administration (Course 3037)10 How to Manage Foreground and Background Processes (continued) Ctrl+Z –Stops a process running in foreground bg –Continues running a stopped process in the background Ampersand (&) –Starts the process in the background Command jobs –List the contents of job control

SUSE Linux Enterprise Server Administration (Course 3037)11 How to Manage Foreground and Background Processes (continued) fg job_ID –Switches a process to the foreground Process termination status –Done –Terminated –Killed

SUSE Linux Enterprise Server Administration (Course 3037)12 How to Prioritize Processes ps –Lists all running processes pstree –Lists processes in the form of a tree structure nice –Assigns a process a specific nice value That affects the calculation of the process priority –Nice level is used by the scheduler To determine how frequently to service a running process

SUSE Linux Enterprise Server Administration (Course 3037)13 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)14 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)15 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)16 How to Prioritize Processes (continued) renice –Changes the nice value of a running process –Only root can reduce nice value of a running process top –Combines the functionality of commands ps and renice –Information displayed Can be filtered by a specific user Can be sorted on any displayed field

SUSE Linux Enterprise Server Administration (Course 3037)17 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)18 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)19 How to Prioritize Processes (continued)

SUSE Linux Enterprise Server Administration (Course 3037)20 How to End a Process kill and killall –Terminate a process –killall Kills all processes with an indicated command name Needs the command name of the process –kill Kills only the indicated process Needs the PID of the process –Signals handled by the kernel SIGKILL and STOP

SUSE Linux Enterprise Server Administration (Course 3037)21 How to End a Process (continued)

SUSE Linux Enterprise Server Administration (Course 3037)22 How to End a Process (continued) KDE System Guard –Started from KDE Desktop –Used to view and kill processes –Steps Select the process from the Process Table Select Kill

SUSE Linux Enterprise Server Administration (Course 3037)23 How to End a Process (continued)

SUSE Linux Enterprise Server Administration (Course 3037)24 Processes and Services (Daemons) Service –Also called a daemon (Disk And Execution MONitor) –Process or collection of processes That wait for an external event to trigger an action Listener –Waits for an event to occur and informs the program –Network listeners are common examples

SUSE Linux Enterprise Server Administration (Course 3037)25 How to Manage a Daemon Process Daemons –Run in the background –Usually started when the system is booted –Terminal-independent processes –Usually their names terminate in “d” Types of daemons –Signal-controlled Activated when a corresponding task exists –Interval-controlled Activated at certain intervals

SUSE Linux Enterprise Server Administration (Course 3037)26 How to Manage a Daemon Process (continued) For each daemon, there is a script in /etc/init.d/ For many scripts –There is a symbolic link in the directory /usr/sbin/ Or in the directory /sbin/ Some important daemons: –cron –cupsd –httpd –sshd –syslogd

SUSE Linux Enterprise Server Administration (Course 3037)27 How to Manage a Daemon Process (continued)

SUSE Linux Enterprise Server Administration (Course 3037)28 Exercise 6-1: Manage Linux Processes and Services In this exercise, you do the following: –Part I: Move Processes in the Background –Part II: Modify Process Priorities –Part III: Enable Services –Part IV: Enable Services Using YaST

SUSE Linux Enterprise Server Administration (Course 3037)29 Describe Startup Shell Scripts and Services Objectives –Startup Scripts –Startup Script Directory Structure –Startup Script Structure

SUSE Linux Enterprise Server Administration (Course 3037)30 Startup Scripts Run as soon as the system is switched to a new runlevel –As long as their dependencies are met Scripts for network-based services –Need to run after the network script is run Network script is not run in runlevel 1 –You cannot use network-based services scripts in runlevel 1

SUSE Linux Enterprise Server Administration (Course 3037)31 Startup Scripts (continued)

SUSE Linux Enterprise Server Administration (Course 3037)32 Startup Script Directory Structure Directory entries –/etc/init.d/ –/etc/init.d/rcn.d/ Link name is prefixed with S (Start) or K (Kill) –And a two-digit numeric value During system startup –Links with an S in front of them are accessed During a clean system shutdown –Scripts with a K in front of them are accessed

SUSE Linux Enterprise Server Administration (Course 3037)33 Startup Script Directory Structure (continued)

SUSE Linux Enterprise Server Administration (Course 3037)34 Startup Script Structure /etc/init.d/skeleton file –Skeleton file for startup scripts Some of the most important parts include: –General Section –Start Section –Stop Section –Restart Section –Force-Reload Section –Reload Section –Status Section –Last Option (*)

SUSE Linux Enterprise Server Administration (Course 3037)35 Startup Script Structure (continued) General Section –Contains commands that are executed regardless of the parameter passed to the script Start Section –Parameters are evaluated using a case statement –Compares the first parameter to the value start Stop Section –Compares the first parameter to the value stop And shuts down the process by sending the SIGTERM signal

SUSE Linux Enterprise Server Administration (Course 3037)36 Startup Script Structure (continued) Restart Section –Used to unconditionally restart the service Force-Reload Section –Commonly used to cause a service to reload its configuration files Reload Section –Like the force-reload parameter –If the service does not support the HUP signal, it does nothing

SUSE Linux Enterprise Server Administration (Course 3037)37 Startup Script Structure (continued) Status Section –Used to verify the service is running Last Option (*) –Used for anything that has not been matched up to this point

SUSE Linux Enterprise Server Administration (Course 3037)38 Schedule Jobs Objectives –Schedule a Job (cron) –Run a Job One Time Only (at)

SUSE Linux Enterprise Server Administration (Course 3037)39 Schedule a Job (cron) Service cron (/usr/sbin/cron) –Schedules jobs to be carried out on a regular basis –Runs as a daemon –Checks once a minute for scheduled jobs crontab –File that contains the list of jobs Types of jobs –System Jobs –User Jobs

SUSE Linux Enterprise Server Administration (Course 3037)40 Schedule a Job (cron) (continued) System jobs –Control system jobs with the file /etc/crontab –/var/spool/cron/lastrun/ directory Contains files with information about the last time jobs were run –Script /usr/lib/cron/run-crons Evaluates script time stamp Determines if scripts have to be run or not –Scripts in /etc/cron.daily/ Standard shell scripts Overwritten when you update your system

SUSE Linux Enterprise Server Administration (Course 3037)41 Schedule a Job (cron) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)42 Schedule a Job (cron) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)43 Schedule a Job (cron) (continued) User jobs –Configure user cron jobs with the following files: /var/spool/cron/allow /var/spool/cron/deny –Stored in the directory /var/spool/cron/tabs/ In files matching the user names Use crontab to edit them Each line in a file defines a job –There are six fields in a line –Sixth field contains the command to run

SUSE Linux Enterprise Server Administration (Course 3037)44 Schedule a Job (cron) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)45 Schedule a Job (cron) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)46 Run a Job One Time Only (at) Use command at Configuration files –/etc/at.allow –/etc/at.deny at command syntax –at launch_time (interactive version) –at –f file launch_time

SUSE Linux Enterprise Server Administration (Course 3037)47 Run a Job One Time Only (at) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)48 Exercise 6-2 Schedule Jobs With cron and at In this exercise, you do the following: –Part I: Schedule Jobs with at –Part II: Schedule Jobs with cron

SUSE Linux Enterprise Server Administration (Course 3037)49 Use System Logging Services Objectives –The syslog Daemon –Important Log Files –How to View Log Files with YaST –How to Archive Log Files (logrotate) –How to Monitor Hard Drive Space

SUSE Linux Enterprise Server Administration (Course 3037)50 The syslog Daemon The syslog daemon (syslogd) –Used by many services to log system events Configuration file –/etc/syslog.conf –Contains one rule per line –Each rule has two fields separated by spaces or tabs –Components Categories Priorities Second Field Options Additional Priority Parameters

SUSE Linux Enterprise Server Administration (Course 3037)51 The syslog Daemon (continued) Categories –Refer to the subsystem that provides the corresponding message Priorities –Give details about the urgency of the message Second Field Options –Determine what will be done with the corresponding message –Options Output of a file Specifying the device file for a text console

SUSE Linux Enterprise Server Administration (Course 3037)52 The syslog Daemon (continued)

SUSE Linux Enterprise Server Administration (Course 3037)53 The syslog Daemon (continued)

SUSE Linux Enterprise Server Administration (Course 3037)54 The syslog Daemon (continued) Second Field Options –Options Specifying a FIFO file Specifying a user list Specifying a computer name with a Using an asterisk (*) Additional Priority Parameters –An equal sign (=) before the priority –An exclamation mark (!) before the priority –Add an asterisk (*) –Set none as the priority

SUSE Linux Enterprise Server Administration (Course 3037)55 Important Log Files /var/log/messages –Most commonly used log file –-- MARK -- is written by syslog daemon every 20 minutes If no other messages to log exist Command tail –Used to read log file –Exit using Ctrl+C

SUSE Linux Enterprise Server Administration (Course 3037)56 Important Log Files (continued)

SUSE Linux Enterprise Server Administration (Course 3037)57 Important Log Files (continued)

SUSE Linux Enterprise Server Administration (Course 3037)58 How to View Log Files with YaST Steps –Start YaST View Start-up Log or View System Log module –Select a log to view from the drop-down list –Close the dialog by selecting OK

SUSE Linux Enterprise Server Administration (Course 3037)59 How to View Log Files with YaST (continued)

SUSE Linux Enterprise Server Administration (Course 3037)60 How to Archive Log Files (logrotate) Ensure log files do not get too large or too complex logrotate program –Monitors the size and age of log files –Run daily by the cron daemon /etc/cron.daily/logrotate /etc/logrotate.conf –Configuration file of logrotate RPM packages contain preconfigured files for evaluation by logrotate –Stored in /etc/logrotate.d/

SUSE Linux Enterprise Server Administration (Course 3037)61 How to Archive Log Files (logrotate) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)62 How to Archive Log Files (logrotate) (continued) Settings in logrotate.d supersede settings in logrotate.conf syslogd –Configure how log files written by syslog will be treated

SUSE Linux Enterprise Server Administration (Course 3037)63 How to Archive Log Files (logrotate) (continued)

SUSE Linux Enterprise Server Administration (Course 3037)64 How to Monitor Hard Drive Space Command /bin/df (disk free) –Shows how much space is occupied and available Command /usr/bin/du (disk usage) –Shows how large individual files or directories are Info Center (Storage Devices) or KDiskFree –Utilities from the KDE desktop –Provide a high-level view of disk space usage Tree View or Detailed List View in Konqueror –Monitor disk space usage by directory or file –Show only individual directory and file sizes

SUSE Linux Enterprise Server Administration (Course 3037)65 How to Monitor Hard Drive Space (continued)

SUSE Linux Enterprise Server Administration (Course 3037)66 How to Monitor Hard Drive Space (continued)

SUSE Linux Enterprise Server Administration (Course 3037)67 How to Monitor Hard Drive Space (continued)

SUSE Linux Enterprise Server Administration (Course 3037)68 Exercise 6-3 Manage System Logging In this exercise, you do the following: –Part I: Modify the Syslog Configuration –Part II: Configure Logrotate

SUSE Linux Enterprise Server Administration (Course 3037)69 Summary Processes are programs that are executing on the system –Every process has a PID and a PPID –Can possibly start an unlimited number of child processes init daemon –First process loaded by the kernel during system initialization Background processes have a job ID –Commands: job, bg, fg

SUSE Linux Enterprise Server Administration (Course 3037)70 Summary (continued) View processes using –KDE System Guard –Commands ps, pstree, and top Stop processes using –KDE System Guard –Commands kill, killall, and top Command nice –Changes process priority Daemon process names typically end with d –Start it with appropriate script in the /etc/init.d directory

SUSE Linux Enterprise Server Administration (Course 3037)71 Summary (continued) init daemon –Loads daemons during system startup Commands may be scheduled to run at a later time –Using at daemon cron daemon –Used to schedule tasks to occur regularly in the future Most log files are stored in the /var/log directory –And created by the syslog daemon –logrotate program is run daily to archive log files Monitor disk usage with df, du, and KDE utilities