
Die crontab wird verwendet, um bestimmte Aufgaben in regelmäßigen Abständen auszuführen. Die Linux-Crontab ähnelt den Windows-Task Schedule. Die Crontab ist sehr nützlich für Routineaufgaben wie die Planung von System-Scans, tägliche Backups, tägliche Statistiken, usw.
Die Crontab führt die Jobs automatisch im Backend zu einem bestimmten Zeitpunkt und in einem bestimmten Intervall aus. In diesem Tutorial lernen Sie die Verwendung der Crontab anhand von 10 nützlichen Beispielen für die Planung von Jobs. Sie können die crontab auch für die Aufgaben verwenden, die in Zukunft nur einmal ausgeführt werden sollen. Für alle Aufgaben, die einmal ausgeführt werden sollen, empfehlen wir jedoch, Linux auf Befehl zu verwenden.
Die Linux-Crontab hat sechs Felder. 1-5 Felder definieren das Datum und die Uhrzeit der Ausführung. Die 6’ten Felder werden für den auszuführenden Befehl oder das auszuführende Skript verwendet. Die Syntax der Linux-Crontab lautet wie folgt:

- Stern (*) – Passt zu allem
- Bereich definieren – Sie können den Bereich mit Hilfe des Hypen like definieren: 1-10 oder 20-30 oder sun-fri oder feb-apr
- Mehrere Bereiche definieren – Sie können mehrere Bereiche mit Befehlen definieren, die wie folgt lauten: jan-mar,jul-sep
Wie man Crontab bearbeitet
Um Jobs in der crontab hinzuzufügen oder zu aktualisieren, verwenden Sie den folgenden Befehl. Dadurch wird eine crontab-Datei im Editor geöffnet, in der ein Job hinzugefügt/aktualisiert werden kann.
crontab -e |
Planen Sie einen Cron, der täglich um 1 Uhr morgens ausgeführt werden soll
Dies ist nützlich, um Datenbank-Backups auf täglicher Basis zu planen. Der Skript backup.sh wird um 01:00 täglich automatisch aufgerufen
0 1 * * * /var/backup.sh |
Planen Sie einen Cron, der zweimal am Tag ausgeführt wird.
Der unten stehende Befehl wird täglich um 1 Uhr morgens und 19 Uhr abends ausgeführt. Sie können mehrere Zeitstempel durch Komma getrennt angeben.
0 1,19 * * * /var/backup.sh |
Planen Sie für jede Minute einen Cron zur Ausführung ein.
Im Allgemeinen benötigen wir kein Skript, das jede Minute ausgeführt wird, aber in einigen Fällen müssen Sie es möglicherweise konfigurieren.
* * * * * /var/script.sh |
Planen Sie alle 5 Minuten einen Cron zur Ausführung
Wenn Sie Ihr Skript im 5-Minuten-Intervall ausführen möchten, können Sie wie unten beschrieben konfigurieren. Diese Arten von Crons sind für die Überwachung nützlich.
*/5 * * * * /var/script.sh |
Planen Sie einen Cron zur Ausführung für ausgewählte Monate.
Manchmal mussten wir eine Aufgabe so planen, dass sie nur für ausgewählte Monate ausgeführt wird. Das unten stehende Beispielskript wird in den Monaten Januar, Mai und August ausgeführt.
* * jan,may,aug * /var/script.sh oder * * 1,5,8 * /var/script.sh |
Planen Sie alle vier Stunden einen Cron zur Ausführung ein
Wenn Sie ein Skript im 4-Stunden-Intervall ausführen möchten. Es kann wie unten konfiguriert werden.
* */4 * * * /var/script.sh |
Planen Sie einen Cron, der alle 15 Sekunden ausgeführt wird.
Eine Aufgabe zu planen, die alle 15 Sekunden ausgeführt werden soll, ist nicht durch Zeitparameter möglich, aber es kann durch den Zeitplan der gleichen cron viermal wie unten ausgeführt werden.
* * * * * /var/script.sh * * * * * sleep 15;/var/script.sh * * * * * sleep 30;/var/script.sh * * * * * sleep 45;/var/script.sh |
Planen Sie mehrere Aufgaben in einem einzigen Cron.
Um mehrere Aufgaben mit einem einzigen Cron zu konfigurieren, können Aufgaben durch das Semikolon ( ; ) getrennt werden.
* * * * * /var/script.sh ; /var/new-script.sh |
Weitere Beispiele
#Jährlich ein Skript ausführen @yearly /var/script.sh #Monatlich ein Skript ausführen @monthly /var/script.sh #Täglich ein Skript ausführen @daily /var/script.sh #Stündlich ein Skript ausführen @hourly /var/script.sh |
ivermectin pediatric dose ivermectin 4000 mcg
mobile casino sites
casino mobile
mobile casino games
dissertation thesis writing
writing paper
marketing acknowledgement
stromectol order stromectol south africa
sildenafil 150 mg buy losartan 50mg generic order cozaar 25mg online
http://stromectolbestprice.com/# ivermectin heartgard
best casino site
casinos online usa
casino real money
http://stromectolbestprice.com/# 1 ivermectin dosage for dogs
ivermectin syrup ivermectin human dosage
Stromectol stromectol pill for humans
furosemide 100 mg furosemide 40 mg pill
online casino games that pay
internet casino bonus
online casinos no deposits
buy nexium 40mg sale purchase cialis tadalafil 20mg oral
https://drugsbestprice.com/# erectile dysfunction treatment
best pharmacy online canadian drug prices
casinos online real money no deposit
casino sign up bonus
online gambling for real money
erectile dysfunction pills generic ed drugs
buy cialis 10mg without prescription buy generic levaquin 250mg order avodart 0.5mg
herbal remedies for ed buy erection pills
best ed pills online muse for ed
deposit casino bonus
bingo casino online
what is the best online casino for real money
buy zantac pills purchase mobic generic buy flomax 0.2mg pills
non prescription ed pills best non prescription ed pills
https://medrxfast.com/# comfortis for dogs without vet prescription
best online canadian pharmacy canada ed drugs
no deposit bonus online casino
online casino win real money
bonus casino online
https://medrxfast.com/# tadalafil without a doctor’s prescription
azithromycin tablets 500mg urethra pain http://zithromax.beauty/ z pack prices
casino online real money
free welcome bonus no deposit
casino sites
non prescription ed pills ed meds online without doctor prescription
ondansetron online order order finasteride 1mg for sale
https://medrxfast.com/# canada ed drugs
am3ye1
non prescription ed pills how can i order prescription drugs without a doctor
fortune healthcare fildena reviews fildena 100mg reviews
prescription drugs pain medications without a prescription
https://medrxfast.com/# dog antibiotics without vet prescription
purchase diflucan generic generic ampicillin 250mg cheap viagra for sale
ventolin generic price ventolin mexico
prescription drugs online without best ed pills non prescription
https://medrxfast.com/# buy prescription drugs without doctor
pain medications without a prescription canadian online drugs
https://medrxfast.com/# meds online without doctor prescription
online casino bonuses
online casino no deposit welcome bonus
no deposit casino real money
brand tadalafil 20mg provigil pills sildenafil 100mg without prescription
buy dedicated ip vpn
vpn download free
what does a vpn do
prescription meds without the prescriptions buy prescription drugs from canada
cheap pet meds without vet prescription buy prescription drugs from india
casino no deposit bonus
best online casino us
best online casinos usa
https://medrxfast.com/# canadian pharmacy online
avast vpn download
best vpn for xbox one
zenmate free vpn
order azithromycin pills azithromycin uk glucophage 500mg tablet
sztaIbvo
albuterol inhaler albuterol without prescription
buy prescription drugs from canada cheap canadian drugs
https://medrxfast.com/# ed drugs online from canada
generic ivermectin stromectol 12 mg tablets ivermectin germany ivermectin buy usa
mobile casinos for real money
online mobile casino
casino bonus no deposit
canadian online drugstore canadian pharmacy online
https://medrxfast.com/# best ed pills non prescription
buy metronidazole 200mg pills buy metronidazole 400mg without prescription order metformin 1000mg online cheap
– female viagra pills viagra for men pfizer viagra 100mg price.
free p2p vpn
hotspot vpn free
the best vpn for windows 10
prescription drugs online without doctor how can i order prescription drugs without a doctor
ventolin 10 mg alluponurol uses ventolin inhaler price at walmart
casino win real money
super slots casino
online casino play for real money
https://medrxfast.com/# ed meds online without doctor prescription
best free vpn for firefox
best vpn for home network
best vpn for pubg
When I read an article on this topic, casinosite the first thought was profound and difficult, and I wondered if others could understand.. My site has a discussion board for articles and photos similar to this topic. Could you please visit me when you have time to discuss this topic?
Of course, your article is good enough, slotsite but I thought it would be much better to see professional photos and videos together. There are articles and photos on these topics on my homepage, so please visit and share your opinions.
canadian pharmacy online buy prescription drugs online legally
cleocin 300mg pills buy erythromycin sale order budesonide