71 lines
2.8 KiB
EmacsLisp
71 lines
2.8 KiB
EmacsLisp
;;; 100-systemd-service-lesson.el --- systemd-service-lesson
|
|
|
|
(defun systemd-service-lesson ()
|
|
"Linux+ lesson for systemd service management."
|
|
(interactive)
|
|
(delete-other-windows)
|
|
(let ((buf (get-buffer-create "*systemd Service Lesson*"))
|
|
(shell (or shell-file-name (getenv "SHELL") "/bin/sh")))
|
|
(switch-to-buffer buf)
|
|
(read-only-mode -1)
|
|
(erase-buffer)
|
|
(insert
|
|
"Linux+ Lesson: systemd Service Management\n"
|
|
"=========================================\n\n"
|
|
"Concept:\n"
|
|
"Learn how to manage services with systemctl and understand\n"
|
|
"the difference between starting, enabling, disabling, and masking.\n\n"
|
|
"Use BOTH VMs:\n"
|
|
"- Debian 13 usually uses service name: ssh\n"
|
|
"- Rocky Linux usually uses service name: sshd\n\n"
|
|
"Core meanings:\n"
|
|
" systemctl start <service> = start now\n"
|
|
" systemctl stop <service> = stop now\n"
|
|
" systemctl restart <service> = stop then start\n"
|
|
" systemctl reload <service> = reload config if supported\n"
|
|
" systemctl enable <service> = start at boot\n"
|
|
" systemctl disable <service> = do not start at boot\n"
|
|
" systemctl enable --now <service> = start now and enable at boot\n"
|
|
" systemctl mask <service> = prevent normal starting\n"
|
|
" systemctl unmask <service> = remove mask\n\n"
|
|
"Hands-on tasks in Debian 13:\n"
|
|
" systemctl status ssh\n"
|
|
" systemctl is-enabled ssh\n"
|
|
" sudo systemctl restart ssh\n"
|
|
" journalctl -u ssh --since today\n\n"
|
|
"Hands-on tasks in Rocky Linux:\n"
|
|
" systemctl status sshd\n"
|
|
" systemctl is-enabled sshd\n"
|
|
" sudo systemctl restart sshd\n"
|
|
" journalctl -u sshd --since today\n\n"
|
|
"Optional lab on either disposable VM:\n"
|
|
" sudo systemctl stop <service>\n"
|
|
" systemctl status <service>\n"
|
|
" sudo systemctl start <service>\n"
|
|
" sudo systemctl disable <service>\n"
|
|
" systemctl is-enabled <service>\n"
|
|
" sudo systemctl enable <service>\n\n"
|
|
"Boot target review:\n"
|
|
" systemctl get-default\n"
|
|
" sudo systemctl set-default multi-user.target\n"
|
|
" sudo systemctl set-default graphical.target\n\n"
|
|
"Exam traps:\n"
|
|
"- enable does not start a service immediately.\n"
|
|
"- disable does not stop a currently running service.\n"
|
|
"- mask is stronger than disable.\n"
|
|
"- reload and restart are not the same.\n"
|
|
"- Debian commonly uses ssh; Red Hat/Rocky commonly uses sshd.\n\n"
|
|
"When finished, run:\n"
|
|
" M-x systemd-service-quiz\n")
|
|
(goto-char (point-min))
|
|
(view-mode 1)
|
|
(split-window-below)
|
|
(other-window 1)
|
|
(let ((term (get-buffer "*term*")))
|
|
(if (buffer-live-p term)
|
|
(switch-to-buffer term)
|
|
(ansi-term shell "term")))
|
|
(other-window -1)))
|
|
|
|
;;; 100-systemd-service-lesson.el ends here
|