Last Sync: 2022-05-23 19:30:04
This commit is contained in:
parent
fafc020e89
commit
68fea6a8dc
1 changed files with 21 additions and 7 deletions
|
@ -4,27 +4,35 @@ tags:
|
|||
- shell
|
||||
- automation
|
||||
---
|
||||
j
|
||||
# Cron
|
||||
|
||||
In Arch Linux I use `cronie` for cron jobs. (There is no cron service installed by default).
|
||||
## Commands
|
||||
|
||||
````bash
|
||||
|
||||
# View list of cron jobs
|
||||
### List cron jobs
|
||||
```
|
||||
crontab -l
|
||||
```
|
||||
|
||||
# Open cron file
|
||||
### Open cron file
|
||||
```
|
||||
crontab -e
|
||||
````
|
||||
```
|
||||
### Check cron log
|
||||
```bash
|
||||
|
||||
\*\*Syntax **
|
||||
journalctl | grep CRON
|
||||
# Different distros have different loggers
|
||||
```
|
||||
|
||||
## Syntax
|
||||
````bash
|
||||
m h d mon dow command
|
||||
# minute, hour, day of month, day of week, bash script/args
|
||||
# 0-59, 0-23, 1-31, 1-12, 0-6
|
||||
````
|
||||
|
||||
|
||||
**Examples**
|
||||
|
||||
Run on the hour every hour
|
||||
|
@ -39,6 +47,12 @@ At 01:42 every day:
|
|||
42 1 * * * mysqlcheck --all-databases --check-only-changed --silent
|
||||
````
|
||||
|
||||
Every half hour:
|
||||
```
|
||||
0,30 * * * * ${HOME}/bash_scripts/automate_commit.sh
|
||||
|
||||
```
|
||||
|
||||
**Shorthands**
|
||||
|
||||
* `@reboot` – Run once, at startup
|
||||
|
|
Loading…
Add table
Reference in a new issue