notes for nerds – pc, server, phones, apps

notes4nerds

— notes.h87.at —

how to create cronjobs

cron is a programm that let you execute an command at any time you want automaticly

it´s very easy just edit the cron file with crontab

1. use Crontab

crontab -l                 # list all cron jobs
crontab -e                 # edit cronjobs

let´s edit cronjobs and paste following code inside for simplicity

#┌───────────── Minute (0 - 59)
#│ ┌───────────── Stunde (0 - 23)
#│ │ ┌───────────── Tag des Monats (1 - 31)
#│ │ │ ┌───────────── Monat (1 - 12)
#│ │ │ │ ┌───────────── Wochentag (0 - 6)
#│ │ │ │ │
#* * * * *  /Pfad/Programmname

in this example we execute a backup command every day at 12:00 pm

paste this line @ the end of cronjob file

0 12 * * * pg_dump -U root database1 > ~/backup.cron.sql

2. little helper

with crontab.guru you can easily create crontabs https://crontab.guru/


Beitrag veröffentlicht

in

von

Schlagwörter:

Kommentare

Schreibe einen Kommentar