Timeline for How to check the process along with its arguments in process list?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 28, 2013 at 12:46 | comment | added | Ankit Vashistha | Thanks for the answer, after trying different ways, i finally chose the locking mechanism. I am applying a lock when a script is executed with some arguments and have given the name of the lock file <arg1_arg2> which i am deleting at the end of the script. This way i am able to have multiple instances of the script running with different arguments than the one already running and block multiple instances of the script with the same arguments so that the script is not executed twice with the arguments already being used in running instace which was my actual requirement. | |
| Dec 25, 2013 at 7:25 | comment | added | DopeGhoti |
It's insecure (anyone could run a process with a matching name), but you can avoid tempfiles with if pgrep $(basename $0) 2> /dev/null; then echo "Already running"; exit 1; fi
|
|
| Dec 25, 2013 at 6:51 | comment | added | Ankit Vashistha | I thought of using lock but i want to do this without creating any temporary files. Already i am using some temp files for the script. | |
| Dec 25, 2013 at 6:44 | history | answered | DopeGhoti | CC BY-SA 3.0 |