Re: 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]

 



On Do, 17.01.19 10:18, Christopher Cox (ccox@xxxxxxxxxxxxxx) wrote:

> On 1/17/19 5:50 AM, Lennart Poettering wrote:
> > With that you can now put together a unit that is terminated
> > relatively early on during shutdown: just make it
> > "After=multi-user.target graphical.target default.target", so that it
> > gets activated at boot very late, and thus deactivated at shutdown
> > very early.
>
> Thanks, I think I had this on one of my many attempts.  But changed to suit.
>
> [Unit]
> Description=my-service-save save run state
> After=multi-user.target graphical.target default.target
>
> [Service]
> Type=oneshot
> ExecStop=/usr/local/bin/my-services.sh save
> RemainAfterExit=yes
>
> [Install]
> WantedBy=multi-user.target
>
> In my case, my script rolls through the currently running processes, looking
> for certain ones, determines listening port (ss) and gets the time the
> process was started (stat) and outputs info to a file.
>
> What I'm seeing is a file at shutdown that does not contain all the
> processes.

Hmm, what kind of processes are you missing? user session stuff? How
do you shut down? Note that display managers are likely to terminate
the user sessions first, and only initiate system shutdown then...

Lennart

--
Lennart Poettering, Red Hat
_______________________________________________
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