Synchronisation automatique entre dépôt des projets et dépôts Redmine
Ajout d'un fichier synchro_depots_hg
pour cron
dans /etc/cron.d
:
- synchro_depots_hg
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command ## 2 * * * * root /root/scripts/synchro_depots_hg.sh
Écriture d'un script synchro_depots_hg.sh
dans le dossier /scripts/root
pour synchroniser les dépôts des projets Redmine avec les gestionnaires de révisions "publics" des projets.
- synchro_depots_hg.sh
#!/bin/bash for file in /srv/repos/hg/*; do if [ -d $file ]; then echo $file cd $file; hg pull -u fi done