Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aptible/docker-cron-example
DEPRECATED - Please see https://github.com/aptible/supercronic instead
https://github.com/aptible/docker-cron-example
Last synced: 12 days ago
JSON representation
DEPRECATED - Please see https://github.com/aptible/supercronic instead
- Host: GitHub
- URL: https://github.com/aptible/docker-cron-example
- Owner: aptible
- License: mit
- Archived: true
- Created: 2014-09-05T02:43:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-07-12T12:46:26.000Z (over 7 years ago)
- Last Synced: 2024-08-01T22:54:13.535Z (3 months ago)
- Language: Makefile
- Homepage:
- Size: 7.81 KB
- Stars: 88
- Watchers: 9
- Forks: 27
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ![](https://gravatar.com/avatar/11d3bc4c3163e3d238d558d5c9d98efe?s=64) aptible/cron-example
_Note: this repository is deprecated. Going forward, we recommend using
[Supercronic][supercronic] instead._---
Example implementation of cron jobs on Docker/Aptible
## Installation and Usage
git clone https://github.com/aptible/docker-cron-example
cd docker-cron-example/
make runThe example will print "aptible/docker-cron-example" once every minute.
## Including Within An App On Aptible
To include within an Aptible app, copy the following 5 body lines of the Dockerfile to your own Dockerfile:
RUN apt-get -y install rsyslog
ADD files/crontab /app/crontab
RUN crontab /app/crontab
ADD files/bin/start-cron.sh /usr/bin/start-cron.sh
RUN chmod +x /usr/bin/start-cron.sh
RUN touch /var/log/cron.log* Installs ```rsyslog``` http://www.rsyslog.com/
* Copies ```crontab``` file from repo/app data to Docker and installs to user's ```crontab```
* Copies ```start-cron.sh``` from repo/app data to Docker
* Adjusts permissions
* Creates log file at ```/var/log/cron.log```Then, copy ```files``` to your own repo, editing ```files/etc/crontab``` with your own task, and `* * * * *` with your own desired job schedule.
Crash course on cron(tab) job schedules https://en.wikipedia.org/wiki/Cron#Format. Consider the asterisk (```*```) like a wild card. Left to rigt the argument positions are:
```
[Minute Arg] [Hours Arg] [Day of month arg] [Month arg] [Day of week]
```To run every 5 minutes:
```
*/5 * * * *
```To run every 5 hours:
```
0 */5 * * *
```Finally, add an entry in your Procfile for the new `cron` process:
cron: /usr/bin/start-cron.sh
## Copyright and License
MIT License, see [LICENSE](LICENSE.md) for details.
Copyright (c) 2015 [Aptible](https://www.aptible.com) and contributors.
[](https://github.com/fancyremarker)
[supercronic]: https://github.com/aptible/supercronic/