Answer the question
In order to leave comments, you need to log in
How to run one script in linux with double run protection?
in the crown set up launch via flock
*/1 * * * * flock -n /tmp/lock -c /var/www/python/x/run.sh > /var/www/python/x/logs/log.txt 2>&1
*/1 * * * * flock -n /tmp/lock -c '/var/www/python/venv_x/bin/python3 /var/www/python/x/test.py' > /var/www/python/x/logs/log.txt 2>&1
Answer the question
In order to leave comments, you need to log in
Add to the beginning of the script to check a specific lck file and exit if it exists.
If not, create a file, run the script and delete the file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question