0
0
Linux CLIscripting~10 mins

Startup and init systems (systemd) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a service named 'nginx' using systemctl.

Linux CLI
sudo systemctl [1] nginx
Drag options to blanks, or click blank then click option'
Astatus
Bstart
Cenable
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'enable' instead of 'start' to run the service immediately.
Using 'status' which only shows service state.
2fill in blank
medium

Complete the code to check the status of the 'ssh' service.

Linux CLI
systemctl [1] ssh
Drag options to blanks, or click blank then click option'
Arestart
Breload
Cdisable
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'restart' which restarts the service instead of showing status.
Using 'disable' which prevents service from starting at boot.
3fill in blank
hard

Fix the error in the command to enable the 'docker' service at boot.

Linux CLI
sudo systemctl [1] docker
Drag options to blanks, or click blank then click option'
Aenable
Bstart
Cstatus
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' which only runs the service now, not at boot.
Using 'status' which only shows service state.
4fill in blank
hard

Fill both blanks to create a systemd service file snippet that runs a script '/usr/local/bin/myscript.sh' after the network is ready.

Linux CLI
[Unit]
Description=My Script Service
After=[1]

[Service]
ExecStart=[2]

[Install]
WantedBy=multi-user.target
Drag options to blanks, or click blank then click option'
Anetwork-online.target
B/usr/local/bin/myscript.sh
Cnetwork.target
D/bin/bash /usr/local/bin/myscript.sh
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'network.target' which may start before network is fully ready.
Using only the script path without the shell in ExecStart.
5fill in blank
hard

Fill all three blanks to write a command that reloads systemd manager configuration, restarts the 'apache2' service, and then checks its status.

Linux CLI
sudo systemctl [1] && sudo systemctl [2] apache2 && sudo systemctl [3] apache2
Drag options to blanks, or click blank then click option'
Adaemon-reload
Brestart
Cstatus
Dreload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reload' instead of 'daemon-reload' which only reloads service configs.
Checking status before restarting the service.