Is there a way for me to tell cron to run an app BUT not run it if a process exist already?
|
|
the simplest way, use pgrep in crontab:
|
||||
|
|
|
This script will not run again if the previous instance hasn't finished. If you want to not run something if another specific process is running, see harrymc's script.
|
||||
|
|
|
This is usually handled by the program itself rather than by 1) 2) On startup, first check for the existence of a pid (process id) file, usually at While it's technically possible to write bash pipes that will do either of these directly into your crontab, it's better to add them to the program being started (so that they'll apply no matter how it gets started) or to write a wrapper script to handle this, as harrymc suggested. |
|||
|
|
|
Run a script, instead of directly the program. There are many possibilities. For example :
|
|||
|
|
|
You could use a lock file in your script, but please see Process Management.
|
|||
|
|