Gỡ bỏ service khỏi Linux

Systemd sử dụng các tập tin để định nghĩa service, gọi là unit. Để gỡ bỏ service thì cần gỡ bỏ unit. Unit có thể được đặt tại:

/etc/systemd/system/ (and sub directories)
/usr/local/etc/systemd/system/ (and sub directories)
~/.config/systemd/user/ (and sub directories)
/usr/lib/systemd/ (and sub directories)
/usr/local/lib/systemd/ (and sub directories)
/etc/init.d/ (Converted old service system)

Sau khi gỡ bỏ, làm tươi systemd:

systemctl daemon-reload
systemctl reset-failed

Dịch vụ “ma”

Systemd có thể liệt kê dịch vụ không tồn tại, kể cả khi đã xóa, bởi nhiều nguyên nhân:

  1. Có một unit khác tồn tại ở một thư mục systemd nào đó
  2. Có một link đến unit tồn tại ở một thư mục systemd nào đó
  3. Service được sử dụng đến bởi một unit khác

Nếu một service được nhắc đến trong một unit nhưng không tồn tại, systemd vẫn sẽ liệu kê service đó với trạng thái not-found. Có thể tìm unit mà nhắc đến service bằng các thủ thuật tìm kiếm trong file text thông thường.


Nguồn tham khảo: Linuxhacks.org

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *