Lab 3: Startup & Shutdown Scripts
Objective:
- To understand and practice the creation and management of startup and shutdown scripts on a Linux system.
Topics Covered:
- Understanding Runlevels
- Creating Custom Startup Scripts
- Managing Service Startup and Shutdown
- Utilizing Cron Jobs for Scheduled Tasks
Lab Exercises:
Exercise 1: Understanding Runlevels
- Explore the concept of runlevels on the Linux system.
- Identify the default runlevel on your system.
- Change the default runlevel temporarily and observe the changes.
- Discuss the significance of different runlevels.
Exercise 2: Creating Custom Startup Scripts
- Create a simple bash script that prints a message to a file during system startup.
- Configure the script to run at the system’s default runlevel.
- Test the script by rebooting the system and checking the output file.
Exercise 3: Managing Service Startup and Shutdown
- Identify a service that starts automatically during system boot.
- Disable the auto-start feature for the chosen service.
- Create a custom service startup script for a fictitious service.
- Test the custom service startup script by rebooting the system.
Exercise 4: Utilizing Cron Jobs for Scheduled Tasks
- Create a bash script that performs a simple task (e.g., creating a timestamped file).
- Schedule the script to run every day at a specific time using the cron job scheduler.
- Verify that the cron job is running as expected.
Lab Documentation:
Provide detailed instructions for each exercise, including command syntax and expected outcomes. Include explanations of the purpose behind each task.