挂起之前 systemd 不会运行自定义脚本

挂起之前 systemd 不会运行自定义脚本

我正在将脚本放置到/lib/systemd/system-sleep/并使用命令暂停系统pm-suspend。但是,我的自定义脚本没有运行。这是脚本属性:

-rwxr-xr-x 1 root root 833 Jan  2 13:13 /lib/systemd/system-sleep/scrub-supervisor.sh

我还尝试创建一个包含以下内容的 systemd 服务文件:

$ cat /etc/systemd/system/check-disk-health-supervisor.service 
[Unit]
Description=Pause running btrfs scrubs on suspend
Before=suspend.target

[Service]
Type=oneshot
ExecStart=/home/ceremcem/.sbin/erik-sync/scrub/scrub-supervisor.sh

[Install]
WantedBy=suspend.target
$ sudo systemctl status check-disk-health-supervisor
● check-disk-health-supervisor.service - Pause running btrfs scrubs on suspend
   Loaded: loaded (/etc/systemd/system/check-disk-health-supervisor.service; ena
   Active: inactive (dead)

这也行不通。遇到这种情况我们该如何调试呢?

相关内容