Linux

 systemd là phiên bản cũ của systemctl. 

ví dụ khi chạy lệnh

anhvu@anhvu-vrtmc:/bin$ stat /sbin/shutdown

  File: /sbin/shutdown -> ../bin/systemctl

  Size: 16        Blocks: 0          IO Block: 4096   symbolic link

Device: 8,3 Inode: 4853221     Links: 1

Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2025-11-20 02:05:24.877139583 +0000

Modify: 2025-07-11 18:52:59.000000000 +0000

Change: 2025-11-15 12:39:19.303141992 +0000

 Birth: 2025-11-15 12:39:19.301142029 +0000

shutdown sẽ được chạy bởi systemctl trong thư mục /bin/systemctl (/sbin/shutdown được trỏ đến /bin/systemctl)
Tương tự với halt, poweroff, reboot

Vậy nên để shutdown thì chạy lệnh systemctl poweroff, systemctl shutdown hoặc systemctl reboot
Có thể chạy trực tiếp poweroff, shutdown trực tiếp mà không cần chạy systemctl (do cơ chế hyperlink đã đề cập ở trên) 

Các lệnh shutdown
shutdown -h now    #shutdown lập tức
shutdown -h +10    #shutdown sau 10 phút cùng với thông báo
Shutdown scheduled for Sun 2021-05-23 11:04:43 PDT, use 'shutdown -c' to cancel

shutdown -c           #hủy shutdown
Broadcast message from duchess@client4 on pts/4 (Sun 2021-05-24 10:56:00 PDT):
The system shutdown has been cancelled
 
shutdown -h +6 "Time to stop working and go outside to play!"       #shutdown sử dụng thông báo custome 
shutdown -h 22:15    #shutdown định trước thời gian cụ thể 
shutdown -r     #reboot 
shutdown -H     #Halt hệ thống mà không tắt nguồn
shutdown    #trỏ đến shutdown -h +1
Shutdown sử dụng Halt, reboot, Poweroff
Halt sẽ dừng mọi dịch vụ hệ thống, tiến trình, unmout file system nhưng nó không tắt nguồn thiết bị đang chạy
reboot sẽ clean shutdown và khởi động lại hệ thống
shutdown sẽ clean shutdown và tắt nguồn hệ thống 








Comments