Ollie
Ollie

Reputation: 1170

Openshift Cronjob Not Running

I have tried to setup a simple cron job running on openshift but once I have pushed the file to openshift and then login and search for the file it does not seem to be there and there is not log output.

  1. I created an application from: https://github.com/smarterclayton/openshift-go-cart
  2. I then installed the cron 1.4 cartridge.
  3. I created a file at .openshift/cron/minutely/awesome_job and set it as 755
  4. I added the following contents:

#! /bin/bash date > $OPENSHIFT_LOG_DIR/last_date_cron_ran

  1. I pushed to the server
  2. Logged in via ssh and run find /var/lib/openshift/53760892e0b8cdb5e9000b22 -name awesome_job for which it finds nothing.

Any ideas which might help as I am at loss why is it not working.

Upvotes: 1

Views: 1951

Answers (3)

Powpow
Powpow

Reputation: 150

You should also put a file named "jobs.allow" under your .openshift/cron/minutely/. So your cron jobs will be executed. For your ref: https://forums.openshift.com/daily-cron-jobs-not-getting-triggered-automatically

And the reason you can find your awesome_job vis ssh login is because it is under /var/lib/openshift/53760892e0b8cdb5e9000b22/app-root/runtime/repo/.openshift, so the command find does not search any files under folders named with . prefixed.

Upvotes: 0

Ollie
Ollie

Reputation: 1170

The issue was not with cron but with the golang cartridge I was using which was removing the .openshift directory.

https://github.com/smarterclayton/openshift-go-cart/issues/10

Upvotes: 1

fat fantasma
fat fantasma

Reputation: 7613

Make sure the execution bit is set on your cron file.

Upvotes: 1

Related Questions