The Crontab File - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

The Crontab File

Description:

Allows the user to submit jobs or commands to the crontab ... This wilt list, at 21:10, all files including passwd' from root directory. 10. At Command (cont'd) ... – PowerPoint PPT presentation

Number of Views:409
Avg rating:3.0/5.0
Slides: 11
Provided by: til44
Category:

less

Transcript and Presenter's Notes

Title: The Crontab File


1
The Crontab File
2
Objectives
  • Discuss and explain the crontab file
  • Learn how to create a crontab file
  • Understand and use the crontab file

3
Crontab File Example
  • Create a crontab file for Dave called davecron
  • vi davecron E
  • echo date to console every 15 minutes between
    6pm and 6am
  • 0, 15, 30, 45 18 06 /bin/echo/ date
  • gt /dev/console
  • Save this file and exit
  • This writes to the console file, since the
    monitor, as all devices, is treated as a file by
    UNIX
  • cron davecron or crontab davecron
  • This copes the crontab file into /var/spool/cron

4
Crontab Files
  • crontab l
  • Lists the crontab files
  • crontab l gt HOME/backupCron
  • Backs up the crontab file
  • crontab e
  • Allows user to edit crontab file
  • crontab r
  • Deletes crontab file
  • crontab backupCron
  • Restores crontab file if backup available

5
Crontab Files
  • delete cor files at 30am on the days
    1,7,14,21,26 of each month
  • 30 3 1,7,14,21,26 /bin find name core exec
    rm \

6
At Command
  • Allows the user to submit jobs or commands to the
    crontab to be executed at a later time
  • General form
  • at -f ltfilenamegt -m -t lttimegt date -l
    -r
  • Some Options
  • f
  • Specifies the file that contains the command to
    run.
  • m
  • Sends mail once the command has been run.

7
At Command (contd)
  • Some Options (contd)
  • t
  • Specifies at what time for the command to be run.
  • Format hhmm. am / pm indication may follow
    the time otherwise
    a 24-hour clock is used.
  • l
  • Lists the commands that have been set to run.
  • r
  • Cancels the command set in the past

8
At Command
  • Some Options (contd)
  • date
  • Specifies the date for it to be run.
  • Format month, date, year.
  • The following quick days may be
    entered
  • today - Indicates the current day
  • tomorrow - Indicates the day following the
    current day.

9
At Command (contd)
  • Examples
  • at 2110
  • Gives atgt prompt
  • atgt find / -name passed print
  • atgt D
  • Exits at
  • This wilt list, at 2110, all files including
    passwd from root directory

10
At Command (contd)
  • Example (contd)
  • Will also produce a warning
  • warning commands will be executed using /bin/sh
    job1 at ltdategt 2110
  • At 2110, the following will be displayed on
    screen
  • /etc/passwd
  • /etc/passwd/passed
  • .
Write a Comment
User Comments (0)
About PowerShow.com