Musterknabe
Musterknabe

Reputation: 6081

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

Upvotes: 2

Views: 1758

Answers (1)

maxime.bochon
maxime.bochon

Reputation: 611

Have you tried this ?

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

Upvotes: 5

Related Questions