Write Your Own Service
A script at /usr/local/bin/stamp.sh writes a timestamp to /run/stamp. Turn it into a proper systemd service called stamp.service: write the unit, enable and start it, and confirm it ran. Password: student.
How it works: the terminal below is a real Linux machine running in your browser. Click it and
type. Tasks tick themselves off as you complete them; questions are answered in the box under each task.
Press Reset any time for a fresh machine. Your password on this machine (for
sudo) is student.
Hints
Write the file with sudo tee /etc/systemd/system/stamp.service <<'EOF' ... EOF.
daemon-reload after writing the unit, then enable, then start.
Solution explanation
The unit's [Service] section points ExecStart at the script and uses Type=oneshot because the script runs once and exits. daemon-reload makes systemd read the new file, enable links it into the boot sequence, and start runs it now — which creates /run/stamp.
Show solution
sudo tee /etc/systemd/system/stamp.service > /dev/null <<'EOF'
[Unit]
Description=Write a timestamp
[Service]
Type=oneshot
ExecStart=/usr/local/bin/stamp.sh
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable stamp
sudo systemctl start stamp
cat /run/stamp