[yocto] How to create a service only startes at shutdown process?

JH jupiter.hce at gmail.com
Fri Aug 9 00:52:00 PDT 2019


Hi ChenQi,

Thanks for the help, I tried following service, it did not work, the
systemd complains bad unit

[Unit]
Description=Application Shutdown Service
Before=multi-user.target

[Service]
Type=oneshot
ExecStart=
ExecStop=/usr/sbin/app_cleanup.sh

[Install]
WantedBy=multi-user.target

>> Most of the services are started in boot, how can I have create a
>> service only to be active in shutdown (not in boot) to clean up?
>>
>> Thank you.
>>
>> Kind regards,
>>
>> - jh
>
> Make use of ExecStop, leave ExecStart to be empty.

I tried it:

[Unit]
Description=Application Shutdown Service
Before=multi-user.target

[Service]
Type=oneshot
ExecStart=
ExecStop=/usr/sbin/app_cleanup.sh

[Install]
WantedBy=multi-user.target

There were errors:

Loaded: bad-setting (Reason: Unit myclean.service has a bad unit file set)

What I could be missing here?

Thank you very much.

Kind regards,

- jh


More information about the yocto mailing list