🐧
Linux
  • syllabus
  • unit 1-Introduction
    • Unit I: Introduction to Linux
    • 2. Advantages of Linux over other operating systems
    • 3.File systems
    • 4.Culture of free software
  • unit 2-Basics of Linux
    • 1.Commands
    • 2.shell
    • 3.Text Editors
    • 4.The file system of Linux
    • 5.Directories and their special purpose
    • 6.permission
  • unit 3-Installation
    • 1. Partitioning
    • 2. Installation of Linux
    • 3. Troubleshooting of installation
  • unit 4-System Administration
    • 1.Root login
    • 2.Superuser
    • 3.Configuration of hardware with kudzu
    • 4. Checking System Space:
    • 5. Monitoring System Performance:
    • 6. Working with a File System:
    • 7.Configuring modules
    • 8.jail shell
    • 9.awk
    • 10.sed
  • unit 5-User Management
    • 1.Creating user accounts
    • 2.Setting user defaults
    • 3.Providing support to users
    • 4.Modifying accounts
    • 5.Deleting user accounts
    • 6.Checking disk quotas
    • 7.Sending mail to all users
  • unit 6-Security and System Handling
    • 1.Understanding shell scripts
    • 2.System startup and shutdown
    • 3.Scheduling system tasks
    • 4.Backing up and restoring
    • 5.Password protection
    • 6.File security
  • unit 7-Setting up a Web Server
    • 1.Introduction to a web server
    • 2.Starting the Apache webserver
    • 3.Configuring the Apache webserver
    • 4.Monitoring server activities
  • unit 8-Setting up DHCP and NIS
    • 1.Introduction to DHCP
    • 2.Setting up DHCP Server
    • 3.Setting up DHCP Client
    • 4.Understand NIS
  • unit 9-Setting up a Database Server
    • 1.Configuring database server
    • 2.Checking the status
    • 3.Working with database
  • unit 10-Setting up DNS
    • 1.Introduction to DNS
    • 2.Setting up DNS and configuration
    • 3.Querying DNS
  • unit 11-ISP Simulation
    • 1.Integration of servers
    • 2.DNS, Web, Email, etc
  • fullform
  • Assignment
  • Practicals
    • 1.Linux utilities
    • 2.OS installation project work
    • 3.User management using a terminal
    • 4.Security level access control list
    • 1.Network setting
    • 2.Server configuration of DHCP, DNS, Database server
    • 3.Demonstration of the web, mail, file server
  • imp questions
    • short-notes
    • unit 1
    • unit 2
    • unit 3
    • unit 4
    • unit 5
    • unit 6
    • unit 7
    • unit 8
    • unit 9
    • unit 10
    • unit 11
    • unit ii
  • services
    • create_service
  • Viva+Practical
    • VIVA questions
    • Practical questions
Powered by GitBook
On this page

Was this helpful?

  1. unit 6-Security and System Handling

3.Scheduling system tasks

Scheduling system tasks is an essential part of system administration and automation. It allows you to automate repetitive tasks, perform maintenance, and execute scripts or commands at specific times or intervals.

1. Using cron for Scheduled Tasks:

cron is a time-based job scheduler on Unix-like operating systems. It allows you to specify when and how often tasks should run. Here's how to use it:

a. The crontab Command:

  1. Open your terminal.

  2. To edit your user-specific cron jobs, use:

    crontab -e
  3. To edit the system-wide cron jobs (requires root privileges), use:

    sudo crontab -e

b. crontab Syntax:

The crontab file uses a specific syntax to define when and what tasks should run. The syntax consists of five fields followed by the command to be executed:

* * * * * command_to_execute
- - - - -
| | | | |
| | | | +----- Day of the week (0 - 7) (Sunday is both 0 and 7)
| | | +------- Month (1 - 12)
| | +--------- Day of the month (1 - 31)
| +----------- Hour (0 - 23)
+------------- Minute (0 - 59)

c. Examples of cron Jobs:

  • To run a script every day at 2:30 PM:

    30 14 * * * /path/to/script.sh
  • To run a command every Monday at 3:00 AM:

    0 3 * * 1 /path/to/command
  • To run a script every 15 minutes:

    */15 * * * * /path/to/script.sh

d. Managing cron Jobs:

  • To list your current cron jobs:

    crontab -l
  • To remove all your cron jobs:

    crontab -r

2. Using at for One-Time Tasks:

The at command allows you to schedule tasks to run only once at a specific time. Here's how to use it:

a. The at Command:

  1. Open your terminal.

  2. To schedule a task, use the at command followed by the time when you want the task to run:

    at <time>

    For example:

    at 2:30 PM
  3. You'll enter an interactive mode where you can input the command(s) to run. Type Ctrl+D to finish entering commands.

b. Examples of at Jobs:

  • To run a script at a specific time (e.g., 3:45 PM):

    at 3:45 PM

    Then, enter the command(s) to execute.

  • To run a command at midnight:

    at midnight
  • To run a command tomorrow at a specific time (e.g., 8:00 AM):

    at tomorrow 8:00 AM

c. Managing at Jobs:

  • To list your pending at jobs:

    atq
  • To remove a specific at job (replace job_number with the job ID from atq):

    atrm <job_number>
  • To remove all your at jobs:

    at -r

Scheduling system tasks using cron and at can greatly simplify the automation of routine tasks and maintenance, making your system administration more efficient and reliable.

Previous2.System startup and shutdownNext4.Backing up and restoring

Last updated 1 year ago

Was this helpful?