0
0
Raspberry Piprogramming~20 mins

Process management with supervisor in Raspberry Pi - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Supervisor Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the output of this Supervisor status command?
You run supervisorctl status on your Raspberry Pi. What output will you see if the service myapp is running and has been up for 5 minutes?
Raspberry Pi
myapp                          RUNNING   pid 1234, uptime 0:05:00
Amyapp RUNNING pid 1234, uptime 0:05:00
Bmyapp STARTING pid 1234, uptime 0:00:10
Cmyapp FATAL Exited too quickly
Dmyapp STOPPED Not running
Attempts:
2 left
💡 Hint
Look for the status that means the program is active and running.
🧠 Conceptual
intermediate
1:00remaining
Which file does Supervisor use to configure managed programs?
On a Raspberry Pi, where do you usually define the programs Supervisor should manage?
A/usr/bin/supervisord
B/var/log/supervisor.log
C/etc/supervisor/conf.d/*.conf
D/home/pi/.supervisorrc
Attempts:
2 left
💡 Hint
Think about configuration files ending with .conf.
🔧 Debug
advanced
2:00remaining
Why does this Supervisor program fail to start?
Given this Supervisor program config snippet, why does the program fail to start? [program:myapp] command=/home/pi/myapp/start.sh user=pi autostart=true autorestart=true The start.sh script is executable and works when run manually.
Raspberry Pi
[program:myapp]
command=/home/pi/myapp/start.sh
user=pi
autostart=true
autorestart=true
AThe command path is incorrect; it should be absolute to /usr/bin/start.sh
BThe start.sh script requires environment variables not set by Supervisor
CThe user 'pi' does not have permission to run Supervisor
DSupervisor cannot run shell scripts directly; it needs a Python script
Attempts:
2 left
💡 Hint
Think about environment differences between manual run and Supervisor run.
📝 Syntax
advanced
1:30remaining
Which Supervisor config snippet correctly restarts a program on failure?
Choose the correct Supervisor program config to restart myapp automatically if it crashes.
A
[program:myapp]
command=/home/pi/myapp/run.sh
autostart=true
restart_on_failure=true
B
[program:myapp]
command=/home/pi/myapp/run.sh
autostart=false
autorestart=false
C
[program:myapp]
command=/home/pi/myapp/run.sh
restart=always
D
[program:myapp]
command=/home/pi/myapp/run.sh
autostart=true
autorestart=true
startretries=3
Attempts:
2 left
💡 Hint
Look for the official Supervisor keys for restarting.
🚀 Application
expert
2:00remaining
How to reload Supervisor config without stopping running programs?
You updated a program config file in /etc/supervisor/conf.d/ on your Raspberry Pi. Which command reloads the config and applies changes without stopping running programs?
Asupervisorctl reread && supervisorctl update
Bsupervisorctl restart all
Csystemctl restart supervisor
Dsupervisorctl reload
Attempts:
2 left
💡 Hint
One command reads new configs, the other applies them.