0
0
Raspberry Piprogramming~10 mins

systemd service for auto-start in Raspberry Pi - Interactive Code Practice

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

Complete the code to specify the service description in a systemd service file.

Raspberry Pi
[Unit]
Description=[1]
Drag options to blanks, or click blank then click option'
AStart Service
BRaspberry Service
CService Auto
DAuto-start Raspberry Pi Service
Attempts:
3 left
💡 Hint
Common Mistakes
Using vague or incomplete descriptions.
Leaving the Description field empty.
2fill in blank
medium

Complete the code to specify the command to start the service in the [Service] section.

Raspberry Pi
[Service]
ExecStart=[1]
Drag options to blanks, or click blank then click option'
A/usr/bin/python3 /home/pi/myscript.py
B/bin/start /home/pi/myscript.py
C/home/pi/myscript.py
Dpython /home/pi/myscript.py
Attempts:
3 left
💡 Hint
Common Mistakes
Not specifying the full path to the Python interpreter.
Omitting the interpreter and only giving the script path.
3fill in blank
hard

Fix the error in the [Install] section to enable the service to start at boot.

Raspberry Pi
[Install]
WantedBy=[1]
Drag options to blanks, or click blank then click option'
Aboot.target
Bdefault.target
Cmulti-user.target
Dstartup.target
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent or incorrect target names.
Using default.target which may not always work as expected.
4fill in blank
hard

Fill both blanks to create a simple systemd service file that runs a script at startup.

Raspberry Pi
[Unit]
Description=[1]

[Service]
ExecStart=[2]
Drag options to blanks, or click blank then click option'
AAuto-start Raspberry Pi Service
B/usr/bin/python3 /home/pi/myscript.py
C/bin/bash /home/pi/start.sh
DRaspberry Pi Startup Script
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping description and ExecStart values.
Using incomplete commands in ExecStart.
5fill in blank
hard

Fill all three blanks to complete a systemd service file that auto-starts a Python script on Raspberry Pi.

Raspberry Pi
[Unit]
Description=[1]
After=network.target

[Service]
ExecStart=[2]
Restart=always

[Install]
WantedBy=[3]
Drag options to blanks, or click blank then click option'
AAuto-start Raspberry Pi Service
B/usr/bin/python3 /home/pi/myscript.py
Cmulti-user.target
Ddefault.target
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect targets in WantedBy.
Not specifying Restart=always to keep the service running.
Omitting the After=network.target line.