SUSE Linux Enterprise Server Administration Course 3037 - PowerPoint PPT Presentation

1 / 71
About This Presentation
Title:

SUSE Linux Enterprise Server Administration Course 3037

Description:

Processes can be switched from foreground to background ... Utilities from the KDE desktop. Provide a high-level view of disk space usage ... – PowerPoint PPT presentation

Number of Views:216
Avg rating:3.0/5.0
Slides: 72
Provided by: facult69
Category:

less

Transcript and Presenter's Notes

Title: SUSE Linux Enterprise Server Administration Course 3037


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

2
Objectives
  • Manage Processes
  • Describe Startup Shell Scripts and Services
  • Schedule Jobs
  • Use System Logging Services

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

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

5
Process Definitions (continued)
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)

7
Process Definitions (continued)
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

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 programs 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

10
How to Manage Foreground and Background Processes
(continued)
  • CtrlZ
  • 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

11
How to Manage Foreground and Background Processes
(continued)
  • fg job_ID
  • Switches a process to the foreground
  • Process termination status
  • Done
  • Terminated
  • Killed

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

13
How to Prioritize Processes (continued)
14
How to Prioritize Processes (continued)
15
How to Prioritize Processes (continued)
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

17
How to Prioritize Processes (continued)
18
How to Prioritize Processes (continued)
19
How to Prioritize Processes (continued)
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

21
How to End a Process (continued)
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

23
How to End a Process (continued)
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

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

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

27
How to Manage a Daemon Process (continued)
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

29
Describe Startup Shell Scripts and Services
  • Objectives
  • Startup Scripts
  • Startup Script Directory Structure
  • Startup Script Structure

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

31
Startup Scripts (continued)
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

33
Startup Script Directory Structure (continued)
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 ()

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

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

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

38
Schedule Jobs
  • Objectives
  • Schedule a Job (cron)
  • Run a Job One Time Only (at)

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

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

41
Schedule a Job (cron) (continued)
42
Schedule a Job (cron) (continued)
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

44
Schedule a Job (cron) (continued)
45
Schedule a Job (cron) (continued)
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

47
Run a Job One Time Only (at) (continued)
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

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

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

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

52
The syslog Daemon (continued)
53
The syslog Daemon (continued)
54
The syslog Daemon (continued)
  • Second Field Options
  • Options
  • Specifying a FIFO file
  • Specifying a user list
  • Specifying a computer name with a prefixed _at_
  • 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

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 CtrlC

56
Important Log Files (continued)
57
Important Log Files (continued)
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

59
How to View Log Files with YaST (continued)
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/

61
How to Archive Log Files (logrotate) (continued)
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

63
How to Archive Log Files (logrotate) (continued)
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

65
How to Monitor Hard Drive Space (continued)
66
How to Monitor Hard Drive Space (continued)
67
How to Monitor Hard Drive Space (continued)
68
Exercise 6-3 Manage System Logging
  • In this exercise, you do the following
  • Part I Modify the Syslog Configuration
  • Part II Configure Logrotate

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

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

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
Write a Comment
User Comments (0)
About PowerShow.com