I am getting error when executing flock command

when I am trying to execute flock through cron job I am getting error.

I am executing

* * * * * /usr/bin/flock -n /usr/local/monitor/asdp_cloudwatch/run_asdp0101.sh

and I am getting below error

/usr/bin/flock: bad number: /usr/local/monitor/asdp_cloudwatch/run_asdp0101.sh

Can anyone solve this. Help can be appreciated.

Upvotes: 1

Views: 2760

Answers (1)

redneb
redneb

Reputation: 23870

flock needs a lock file and a command to run. You've only specified one argument. I'm assuming that it is the command, so must also specify the command to run. Something like that:

* * * * * /usr/bin/flock -n /path/to/lockfile /usr/local/monitor/asdp_cloudwatch/run_asdp0101.sh

You need to adjust /path/to/lockfile of course.

Upvotes: 1

Related Questions