Skip to content
Advertisement

flock: -c requires exactly one command argument

We have multiple cronjobs running on our system. The problem is that we run them every hour, and therefore sometimes the cronjob didn’t finish and a new instance has started. Because of that, we wanted to use flock so the script only gets executed once.

However, when I have this in my crontab or run it alone

flock -n /var/www/socialstuff/analytics.lock -c /usr/bin/php /var/www/socialstuff/cronjobs/analytics.php

I’m getting the error

flock: -c requires exactly one command argument

I used this tutorial to define the cronjob

http://www.elevatedcode.com/2013/05/07/flock-for-cron-jobs.html

Advertisement

Answer

Have you tried this ?

flock -n /var/www/socialstuff/analytics.lock -c "/usr/bin/php /var/www/socialstuff/cronjobs/analytics.php"
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement