This commit is contained in:
Rico Sta. Cruz 2017-08-29 00:58:09 +08:00
parent 54e12ddae9
commit 8e91d64dba
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 55 additions and 38 deletions

69
cron.md
View File

@ -1,41 +1,58 @@
---
title: Cron
category: CLI
layout: 2017/sheet
tags: [Featured]
---
### Format
* Min Hour Day Month Weekday
## Format
{: .-two-column}
### Format
* * * * * command to be executed
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 6) (0 or 6 are Sunday to Saturday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
```
Min Hour Day Mon Weekday
```
{: .-setup}
```
* * * * * command to be executed
```
```
┬ ┬ ┬ ┬ ┬
│ │ │ │ └─ Weekday (0=Sun .. 6=Sat)
│ │ │ └────── Month (1..12)
│ │ └─────────── Day (1..31)
│ └──────────────── Hour (0..23)
└───────────────────── Minute (0..59)
```
{: .-setup}
### Examples
0 * * * * every hour
*/15 * * * * every 15 mins
0 */2 * * * every 2 hours
0 0 0 * 0 every sunday midnight
| Example | Description |
| --- | --- |
| `0 * * * *` | every hour |
| `*/15 * * * *` | every 15 mins |
| `0 */2 * * *` | every 2 hours |
| `0 0 0 * 0` | every Sunday midnight |
| --- | --- |
| `@reboot` | every reboot |
@reboot every reboot
### Crontab
### crontab
```bash
# Adding tasks easily
echo "@reboot echo hi" | crontab
```
# Adding tasks easily
echo "@reboot echo hi" | crontab
```bash
# Open in editor
crontab -e
```
# Open in editor
crontab -e
# List tasks
crontab -l [-u user]
```bash
# List tasks
crontab -l [-u user]
```

View File

@ -30,13 +30,13 @@ Jekyll
As of github-pages v156.
jekyll-github-metadata
----------------------
GitHub Metadata
---------------
### Configuration
```yaml
gems:
whitelist:
- jekyll-github-metadata
repository: username/project
@ -63,13 +63,13 @@ See: [Repository metadata on GitHub pages](https://help.github.com/articles/repo
</a>
```
jekyll-gist
-----------
Gists
-----
### Configuration
```yaml
gems:
whitelist:
- jekyll-gist
```
@ -83,13 +83,13 @@ See: [jekyll-gist](https://github.com/jekyll/jekyll-gist)
This places a Gist in your page.
jekyll-mentions
---------------
Mentions
--------
### Configuration
```yaml
gems:
whitelist:
- jekyll-mentions
```
@ -104,14 +104,14 @@ Hey @rstacruz, what do you think of this?
Just mention anyone in any page. Their names will be turned into links.
jekyll-redirect-from
--------------------
Redirects
---------
{: .-three-column}
### Configuration
```yaml
gems:
whitelist:
- jekyll-redirect-from
```