Answer the question
In order to leave comments, you need to log in
What is the correct way to write Unit systemd?
Tell me how to write a unit correctly so that it runs the script on shutdown / reboot / sleep?
Now it's written like this
[Unit]
Before=hibernate.target hybrid-sleep.target suspend.target shutdown.target poweroff.target
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c "/etc/init.d/zabbix-4shutdown.script stop"
RemainAfterExit=true
[Install]
WantedBy=graphical.target
[Unit]
Before=shutdown.target poweroff.target
Conflicts=reboot.target
Requires=network.target
[Service]
Type=oneshot
ExecStop=/bin/bash -c "/etc/init.d/zabbix_4shutdown.script stop"
RemainAfterExit=true
[Install]
WantedBy=network.target
Answer the question
In order to leave comments, you need to log in
Yes, I also encountered this.
I can’t remember exactly what happened now, but you can try:
Requires=graphical.target
then it will be cut down when graphical.target is cut down.
Or something more reasonable to cling to.
Let's say to network.target.
Without a network, then zabbix is definitely not needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question