What is the linux command to find if a process say aa.sh is running or not. ps command does not seem to work and it does not show the shell script names.
Please advise.
Create PID file sh. pid # Add check for existence of mypidfile if [ -f $mypidfile ]; then echo "script is already running" exit fi # Ensure PID file is removed on program exit. trap "rm -f -- '$mypidfile'" EXIT # Create a file with current PID to indicate that process is running.
You can list running processes using the ps command (ps means process status). The ps command displays your currently running processes in real-time.
Use the "-n" option ... bash will check the syntactical validity of a script without running it.
Check this
ps aux | grep "aa.sh"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With