Crate process_utils

Source
Expand description

Just some random process manipulation functions that I’ve found useful

Functions§

find_all_pids
Walk through /proc and find all processes with the name that equals the cmd_name.
get_cmdline
Get the cmdline used to start the process
kill_and_restart
Kills a process and optionally the parent process and restarts them. simulate will just log and not kill anything. Currently SIGTERM is used to nicely stop processes and wait for them to exit. If you need a bigger hammer this isn’t the function for you.
spinlock
Simple spinlock that waits a certain number of milliseconds while a pid still exists.