how to get notified if a specific program starts running?

Viewed 61

I want to ask about how to get notified if a program starts running in a shell script without checking it in a loop with 'pidof' for example, which consume CPU resources.

1 Answers

You can use the inotifywait command

inotifywait -e open /usr/bin/ls

change ls for your desired program.

See inotify-tools packages.

Related