3 ms·
I must be missing something. Why wouldn't something like 'echo "kill -KILL $(ps -C [name] -o pid=)" | at now + 2 minutes' work? You obviously need to run this
by necovek 2y ago
I must be missing something.
Why wouldn't something like 'echo "kill -KILL $(ps -C [name] -o pid=)" | at now + 2 minutes' work? You obviously need to run this before the new processes are started up, but it will only do the `kill` 2 minutes later after the new processes are started.
To expand on what the above command does:
1. echo is to print out a command to add as the job for the `at` command
2. kill command sends the KILL signal (you can also do -9, but I prefer names like TERM or INT or KILL for clarity), and "materializes" the PID when it's echoed out, and does not get re-run after 2 minutes
3. at command allows you to schedule execution of a command on POSIX systems (see https://linux.die.net/man/1/at https://linux.die.net/man/1/at)