How to enabled systemd unit files automatically using recipe?
Hello,
This might not be directly related to Yocto.
I have a systemd .path unit file that restarts the system service if the file changes. But, the path ubit file needs to be enabled once to make this work. So, my question is when I flash new image on the device will the path unit file enabled automatically by systemctl? Or should I do this manually using "systemctl enable --now *.path" ? Is there any way to make this work using Yocto recipe?
The custome systemd service files are installed in dir "${D}${systemd_unitdir}/system/".
Thanks in advance
Quoted 9 lines · Sourabh Hegde
Hello,
This might not be directly related to Yocto.
I have a systemd .path unit file that restarts the system service if the file changes. But, the path ubit file needs to be enabled once to make this work. So, my question is when I flash new image on the device will the path unit file enabled automatically by systemctl? Or should I do this manually using "systemctl enable --now *.path" ? Is there any way to make this work using Yocto recipe?
The custome systemd service files are installed in dir "${D}${systemd_unitdir}/system/".
Quoted 9 lines
Thanks in advance
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#58406): https://lists.yoctoproject.org/g/yocto/message/58406
Mute This Topic: https://lists.yoctoproject.org/mt/94553177/3617615
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
You should add you file to your bb recipe SYSTEMD_SERVICE:${PN} = "file.path"
https://docs.yoctoproject.org/current/ref-manual/classes.html?highlight=systemd_service
Signature · 2 lines
Best Regards, Sergei Nikulov
Hello Sergei,
Thanks for the update.
I have already added " SYSTEMD_SERVICE:${PN}" to my recipe. But, it is set to different file(.service file). Can I add multiple files to it?
Yes, sure.
Use space to separate multiple paths
For example:
SYSTEMD_SERVICE:${PN} = "one.service two.service one.path two.path"
Quoted 14 lines · Sourabh Hegde
Hello Sergei,
Thanks for the update.
I have already added "SYSTEMD_SERVICE:${PN}" to my recipe. But, it is set to different file(.service file). Can I add multiple files to it?
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#58410): https://lists.yoctoproject.org/g/yocto/message/58410
Mute This Topic: https://lists.yoctoproject.org/mt/94553177/3617615
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Best Regards, Sergei Nikulov
Cool. Thanks again
I have a question here:
If I something like below in my recipe
SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'one.service', '', d)}"
Then, can I add multiple files with:
SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'one.service one.path two.service two.path', '', d)}"
?
Is this valid? Or should I use only SYSTEMD_SERVICE:${PN} = "one.service two.service one.path two.path" ?
Thanks in advance