Script gets executed multiple times by cron

Hello,

I’m running this script https://gist.github.com/4591053 on a freebsd
(default) crontab server using RVM + cron configuration. I don’t know
for which reason
but the program gets executed multiple times. I just want to execute the
program one time every day at 4 a.m. (local time).

Here’s my freebsd user crontab:

[atma@comodino ~/Code/rankclient]$ crontab -l

atma’s crontab!

Shell variables for crontab

SHELL=/usr/local/bin/bash
PATH=/home/atma/.rvm/gems/ruby-1.9.3-p194/bin:/home/atma/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/atma/.rvm/rubies/ruby-1.9.3-p194/bin:/home/atma/.rvm/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/atma/bin:/home/atma/.rvm/bin
RUBYLIB=/home/atma/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/
GEM_HOME=/home/atma/.rvm/gems/ruby-1.9.3-p194
GEM_PATH=/home/atma/.rvm/gems/ruby-1.9.3-p194:/home/atma/.rvm/gems/ruby-1.9.3-p194@global

  • 4 * * * /home/atma/Code/rankclient/rankclient.rb

When I’m running this script manually everything works fine. But when
I’m running this script using crontab, well it gets execute 10+ times in
a row.

Any idea why this happens?

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0

On Tue, 22 Jan 2013, Panagiotis A. wrote:

Shell variables for crontab

SHELL=/usr/local/bin/bash

PATH=/home/atma/.rvm/gems/ruby-1.9.3-p194/bin:/home/atma/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/atma/.rvm/rubies/ruby-1.9.3-p194/bin:/home/atma/.rvm/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/atma/bin:/home/atma/.rvm/bin

RUBYLIB=/home/atma/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/
GEM_HOME=/home/atma/.rvm/gems/ruby-1.9.3-p194

GEM_PATH=/home/atma/.rvm/gems/ruby-1.9.3-p194:/home/atma/.rvm/gems/ruby-1.9.3-p194@global

  • 4 * * * /home/atma/Code/rankclient/rankclient.rb

Try putting something in the minutes field.

– Matt
It’s not what I know that counts.
It’s what I can remember in time to use.

On Mon, Jan 21, 2013 at 6:55 PM, Panagiotis A.
[email protected] wrote:

  • 4 * * * /home/atma/Code/rankclient/rankclient.rb

This is telling cron to run the job every minute in the 4th hour. See
man 5 crontab.

Hello,

I’ve read two quick guides, I thought I figured but apparently I got it
all wrong! Makes perfectly sense.

Thanks for the explanation,

Best Regards

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0