27 lines
574 B
Markdown
27 lines
574 B
Markdown
# Planification de tâche
|
|
## Prérequis
|
|
|
|
## OldSchool with cron
|
|
|
|
Utiliser la commande tar pour faire une archive de votre répertoire personnel dans /var/backups
|
|
|
|
Utiliser cron pour planifier cette tâche toutes les heures, du lundi au vendredi
|
|
|
|
```bash
|
|
cat /etc/crontab
|
|
15 * * * 1-5 root tar cpzf /var/backups/home/tgz /home/tom
|
|
```
|
|
|
|
## NewSchool with systemd timer
|
|
|
|
Faire la même chose avec un timer systemd
|
|
|
|
```bash
|
|
cat /etc/systemd/system/backup.timer
|
|
[Unit]
|
|
Description=hourly backup
|
|
[Timer]
|
|
OnCalendar=Mon-Fri *-*-* *:15:00
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
``` |