Cron with interval 1 second, yaml based configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin 3b43b44e9f readme 7 months ago
build/package add tasks directory to package 10 months ago
vendor update modules, update pipeline 10 months ago
.gitignore fix packaging 10 months ago
Dockerfile update modules, update pipeline 10 months ago
Jenkinsfile fix path 10 months ago
config.go added gracefulstop period 2 years ago
file_utils.go added gracefulstop period 2 years ago
go.mod update modules, update pipeline 10 months ago
go.sum update modules, update pipeline 10 months ago
gogocron.go added gracefulstop period 2 years ago readme 7 months ago
timing.go added configuration file with adjustable precision and tasks location 2 years ago

gogocron - one second crontab daemon

Cron daemon with crontab syntax, small interval and execution timeout for each task. Report bugs here


  • customizing tasks files location
  • traditional crontab syntax for defining run intervals
  • 1 second minimal interval
  • your own ENV variables for whole task
  • adjustable run precision from 10 ms to 500 ms
  • batch of commands to run in one task
  • run task commands as other user
  • timeout for whole task with default graceful period 10s
  • SIGHUP process to reload config files
  • adjustable graceful timeout period for each command in task



  • root user privileges to run su command
  • available su command in $PATH

Ubuntu\Debian repository

Check before that curl and tee installed.

curl | sudo apt-key add -
echo "deb bionic main" | sudo tee /etc/apt/sources.list.d/21h.list
sudo apt install gogocron

Manual deb package installation

You can find binary code in Releases tab or build code yourself.

Installation example (change download url to last release):

$ wget --content-disposition ""
$ dpkg -i gogocron-1.1.deb
$ systemctl enable gogocron
$ systemctl start gogocron

Build code yourself

Install Golang, then build:

go get
go get


Global configuration options

All global options loads once at daemon start and HUP signal have no effect on them, use restart command: systemctl restart gogocron.


Run precision means how frequently gogocron checks that second was incremented. What this means to you? Answer is how fast task will run after new second begin + some delta time for filtering tasks to run. Default value is 100 ms, but if you lower this value the checking circle get more CPU resources because checks to be more frequent.

Edit /etc/gogocron/gogocron.yml:

ticktack_precision: 100ms

Tasks location

Set location where tasks files stored.

Edit /etc/gogocron/gogocron.yml:

tasks_location: /etc/gogocron/configs

Tasks configuration options

gogocron reloads all tasks configurations after receiving HUP signal, use reload or restart command to apply new task configuration: systemctl reload gogocron.


Set interval how often run task (whole batch of commands in task). Use traditional crontab syntax.

runsecond // second
runminute // minute
runhour   // hour
rundom    // day of month
runmonth  // month
rundow    // day of week


If whole task (not one command in task) running more than timeout cron send SIGTERM signal, by default timeout is turned off.

timeout: 3h12m4s

It's a golang's time.Duration definition, string:

  • 1s - one second
  • 1m10s - one minute and 10 seconds

Graceful stop

By default if task's command not die after SIGTERM in 10s cron send SIGKILL signal. You may need this if your program receiving signals but internal queue not empty for immidiately stop.

You can change this time with:

gracefulstop: 30s

It's a golang's time.Duration definition, string:

  • 1s - one second
  • 1m10s - one minute and 10 seconds


Array of environment variables (strings). Defines additional to gogocron's env variables for each command in commands array.


  - TESTVAR="test variable"


Array of commands (strings). Commands in one task running line by line with environment variables defined in ENV.


  - whoami
  - sleep 3
  - head -c 20 /dev/urandom |base64
  - ls
  - echo $TESTVAR

Logging of task

logtype can accept:

  • info (default, logging only fact of run)
  • full (log fact of run and stdout/stderr, useful for debugging)
  • disabled (completely disable logs)

Sample task configuration file

You never see variable value because timeout kill this task earlier.

name: "Print base64 of 20 random symbols"
runsecond: "*/5"
logtype: info
timeout: 10s
user: vlad
  - TESTVAR="text you never see"
  - whoami
  - sleep 3
  - head -c 20 /dev/urandom |base64
  - ls
  - sleep 10
  - echo $TESTVAR

Copyright by Vladimir Smagin (21h) 2019-2020 email:
Project page: