kunpengku
kunpengku

Reputation: 127

crontab task execute twice

this is my crontab configuration: */15 * * * * /home/chenglei/scripts/recharge_monitor.sh but ,every 15mins, it seems like the script executes twice.

in the scrpit I '>>' something to a file. I use 'echo "$cardmsg" >> $MonitorLog' to print to file.

the result I want is:

    08-06 08:57 a recharge [85] in past 15 mins
    08-06 08:58 ca recharge [158] in past 30 mins

but the fact is why:

        08-06 09:30 a recharge [85] in past 15 mins.
        08-06 09:30 a recharge [68] in past 15 mins.
        08-06 09:31 ca recharge [158] in past 30 mins.
        08-06 09:31 ca recharge [158] in past 30 mins.

and you see the second lines is wrong.
Thanks for your help.

Upvotes: 1

Views: 1989

Answers (3)

Vikas Aggarwal
Vikas Aggarwal

Reputation: 156

try using ps aux | grep cron may be there are two instances running

or

try looking into /var/spool/cron/ check if all the entries are right

else try restarting crond

Upvotes: 0

Dipak G.
Dipak G.

Reputation: 725

Are you sure that there's no double crond running at the same time?

Try this and check...

ps -A

Upvotes: 1

Leo
Leo

Reputation: 6570

try

ps -A 

to check if there are not two crond running

Upvotes: 1

Related Questions