check that script is not running twice

using ps -ef | fgrep "ld_data"

how do i write a script to check that it didn't already run

Thanks

Easiest way is:

ps -ef | grep "[l]d_data" || ld_data

That will run the program "ld_data" if and only if it is not found already running. Placing the first character within square brackets protects the "grep" command line from being found and triggering a false positive.

Thank you