U
U
UniverseElement2020-05-27 18:29:05
linux
UniverseElement, 2020-05-27 18:29:05

How to programmatically determine the path to the folder where the service starts from in Linux?

On Debian, I can read a file in /etc/systemd/system/ and take the path from the ExecStart parameter. Perhaps there are other ways?

There are also Linux distributions without systemd and I would like to understand how to get this information there. Where and how is it stored?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
paran0id, 2020-05-27
@paran0id

/etc/init.d/ contains sysV init scripts.
And the full path to the binary of any running process can be checked, knowing the PID:
ls -la /proc/PID/exe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question