TIL - SystemD and $MAINPID
TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post
A special environmnent variable, $MAINPID, is set and is available for the .service file. The variable exposes the MainPID property of the service and could be useful if your custom services e.g. forks.
This let you do
ExecReload=/bin/kill -HUP "$MAINPID"
To send a HUP signal to the main process created by your service.
You can read out the MainPID property of a process by using systemctl:
systemctl [--user] show --property MainPID --value <service>
Read more about it in the systemd.service manual [1].
FEATURED TAGS
ai
audio
beer
birds
blacksmith
board games
booting
buildroot
camera
clockwork
cultivation
debugging
device drivers
dnd
docker
gcc
git
gnu radio
go
ham
home control
hugo
i2c
knives
leatherwork
libostree
linux
linux kernel
lora
network
programming
qemu
radio
repair
reverse engineering
swupdate
systemd
til
tools
u-boot
udev
v4l2
vim
wireless
yocto
zephyr