At wits end... need to execute a script prior to anything getting killed/changed on reboot/shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to be able to execute a script before anything gets shutdown. That is, when somebody does a "reboot", "shutdown" or "poweroff", I need this script to run first, and for it to finish before everything gets whacked.

I know the following isn't "right"... I've tried so many different things. Google hasn't helped only giving me many "right" solutions that didn't work. In this current edition, basically I get a partial capture of processes that are running (that is some were killed directly or indirectly).. I need them all. My script needs to see the state of operation before reboot/shutdown/poweroff do anything else. My "save" saves some information about running processes (some not necessarily under systemd control).

[Unit]
Description=my-service save status
DefaultDependencies=no
Before=reboot.target shutdown.target
Conflicts=reboot.target shutdown.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecStop=/usr/local/bin/my-service.sh save
StandardOutput=journal

[Install]
WantedBy=multi-user.target

_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux