• Stars
    star
    138
  • Rank 264,508 (Top 6 %)
  • Language
    Shell
  • License
    ISC License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run cron jobs in a standardized environment with logs and locking

ohmycron -- Cron simplified

OhMyCron Logo

Frequently when debugging cron jobs, one finds that:

  • One needs to use locks to keep more than one copy of frequently running jobs from running at the same time.

  • One wishes to load the user environment -- /etc/profile as well as RC files in HOME.

  • Generally, one would cd to HOME for application specific users.

  • The path should include /usr/local/bin.

  • The output of the cron job should be logged to Syslog, which both prevents cron from raising errors about mailers and allows you to see what went wrong if something did.

ohmycron does all this and more, managing locks with a POSIX API, so that the OS takes care of cleaning up locks for failed proceseses.

ohmycron as a wrapper

Prepending ohmycron to the commands in your crontab keeps your crontab clean and transparently adds logging, locking and environment loading.

* * * * *  root  ohmycron sleep 10
* * * * *  root  ohmycron --tag update:ohmycron -- curl -sSfL 'https://raw.githubusercontent.com/instacart/ohmycron/master/ohmycron' -o /usr/local/bin/ohmycron

ohmycron as the cron shell

Setting SHELL=/usr/local/bin/ohmycron (or another path if you have installed ohmycron elsewhere) transparently adds locks, logging and environment setup to all the jobs in a cron file. (Tasks are actually run with Bash.) It is does something the wrapper can't do, too: support multi-statement commands which use the shell operators &&, |, || and so forth.

SHELL=/usr/local/bin/ohmycron
* * * * *  root  sleep 10
* * * * *  root  : update:ohmycron ; curl -sSfL 'https://raw.githubusercontent.com/instacart/ohmycron/master/ohmycron' -o /usr/local/bin/ohmycron

You can explicitly name a cron job with a Bash "no-op comment": : <some words> ;. (In Bash, : is a no-op; the arguments to the no-op command are ignored.)

Installation

sudo curl -sSfL 'https://raw.githubusercontent.com/instacart/ohmycron/master/ohmycron' -o /usr/local/bin/ohmycron
sudo chmod a+rx /usr/local/bin/ohmycron

More Repositories

1

lore

Lore makes machine learning approachable for Software Engineers and maintainable for Machine Learning Researchers
Python
1,549
star
2

truetime-android

Android NTP time library. Get the true current time impervious to device clock time changes
Kotlin
1,415
star
3

Nantes

Swift TTTAttributedLabel replacement
Swift
1,109
star
4

makara

A Read-Write Proxy for Connections; Also provides an ActiveRecord adapter.
Ruby
902
star
5

TrueTime.swift

NTP library for Swift and Objective-C. Get the true time impervious to device clock changes.
Swift
589
star
6

wilson_score

Simple, dependency-free Wilson score
Ruby
154
star
7

formula

A functional reactive framework for managing state and side effects based on RxJava.
Kotlin
151
star
8

ahab

Docker event handling with Python
Python
137
star
9

amountable

An easy and transparent way to attach, manage and sum Money fields to your ActiveRecord models.
Ruby
123
star
10

jardin-archived

A pandas.DataFrame-based ORM.
Python
84
star
11

Snacks

The Instacart Component Library
JavaScript
81
star
12

redux-rails

Redux and your server talking without fuss.
JavaScript
56
star
13

arn

A Python library for parsing AWS ARNs.
Python
44
star
14

ahoy-android

Android attribution library build on top of Ahoy for Ruby on Rails.
Java
20
star
15

cwam

CloudWatch Alarms Manager. Easy way to create default CloudWatch Alarms for AWS resources.
Python
19
star
16

gadjit

Python
16
star
17

instacart-android-pp-sandbox

Android challenge sandbox
Kotlin
9
star
18

aws-scripts-mon

[TO BE DELETED] Clone of AWS Cloudwatch Monitor Scripts + report inodes
Perl
4
star
19

redux-rails-resource

Simple interface of redux-rails resources for react components
JavaScript
3
star
20

OmniAX

UIAccessibility wrapper
Swift
2
star
21

instacart-ios-pp-starter

Starter app to give candidates starting on pair programming exercise
Swift
2
star
22

ExploreRxSwift

Swift
2
star
23

cloudflare-rails

Ruby
2
star
24

SocketLogger.swift

Lightweight, flexible logging utility compatible with any socket-based syslog service.
Swift
2
star
25

optplayground

A playground for optimization!
Python
1
star
26

instacart-android-pp-starter

Starter app to give candidates starting on pair programming exercise
Java
1
star
27

activerecord-import_with_callbacks

A library for bulk importing data using ActiveRecord
Ruby
1
star