Question:
The tmp/pids/server.pid
contains one line – the process number.
How to get this line and assign this value to a variable?
In the end, you just need to kill the process with kill -9
.
Answer:
Example:
$ pid=$(cat /var/run/sshd.pid)
$ echo $pid
3528
if you just need to kill the process, then you can do it without a variable:
kill -9 $(cat /var/run/sshd.pid)