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.
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.
You can use the inotifywait command
inotifywait -e open /usr/bin/ls
change ls for your desired program.
See inotify-tools packages.