kakachi_hatake
kakachi_hatake

Reputation: 1

how to get notified if a specific program starts running?

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.

Upvotes: 0

Views: 509

Answers (1)

Germán
Germán

Reputation: 21

You can use the inotifywait command

inotifywait -e open /usr/bin/ls

change ls for your desired program.

See inotify-tools packages.

Upvotes: 1

Related Questions