X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fpostgres%2Ftemplates%2Fbackup_server%2Fpostgres-make-base-backups.erb;h=0a710496a0419ed326d82d906fc2cd2b31463414;hb=cb14bc7f1fa660424ab16d5210f14bc891fe442a;hp=b0d7d32b46de615380af09d8ec9acb9d0048cf0d;hpb=53b3322251f1b6f1c6c57f800c13b2b9ba711138;p=mirror%2Fdsa-puppet.git diff --git a/modules/postgres/templates/backup_server/postgres-make-base-backups.erb b/modules/postgres/templates/backup_server/postgres-make-base-backups.erb index b0d7d32b4..0a710496a 100755 --- a/modules/postgres/templates/backup_server/postgres-make-base-backups.erb +++ b/modules/postgres/templates/backup_server/postgres-make-base-backups.erb @@ -41,6 +41,11 @@ STATEDIR=/var/lib/dsa/postgres-make-base-backups #### set -u +if [ "$(id -u)" = 0 ]; then + echo >&2 "Do not run me as root. Probably you want sudo -u <%= scope['postgres::backup_server::globals::backup_unix_user'] %>." + exit 1 +fi + SELF="`basename "$0"`[$$]" DELTA_WAIT_SUCCESS=$(( MAX_WAIT_SUCCESS - MIN_WAIT_SUCCESS )) MYHOSTNAME=$(hostname -f) @@ -96,7 +101,7 @@ while read host port username cluster version; do flagfilesuccess="$STATEDIR/$host-$port.last-success" if [ -n "$forcehostport" ]; then if [ "$forcehostport" != "$host:$port" ]; then - log "Skipping $host:$port $version/$cluster because this run is limited to $host:$port." + log "Skipping $host:$port $version/$cluster because this run is limited to $forcehostport." runme=0 else log "Forcing $host:$port $version/$cluster run." @@ -152,23 +157,11 @@ while read host port username cluster version; do log "Running $host:$port $version/$cluster." /usr/local/bin/postgres-make-one-base-backup "$host" "$port" "$username" "$cluster" "$version" rc=$? + log "Base backup for $host:$port $version/$cluster exited with rc $rc." [ "$rc" = 0 ] && touch "$flagfilesuccess" flock -u 201 else log "Cannot acquire lock on $flagfile, skipping $host:$port $version/$cluster." fi fi -done << EOF -seger.debian.org 5432 debian-backup dak 9.6 -bmdb1.debian.org 5435 debian-backup main 9.6 -bmdb1.debian.org 5436 debian-backup wannabuild 9.6 -bmdb1.debian.org 5440 debian-backup debsources 9.6 -fasolo.debian.org 5433 debian-backup dak 9.6 -sibelius.debian.org 5433 debian-backup snapshot 9.4 -sallinen.debian.org 5473 debian-backup snapshot 9.6 -<%- if @hostname != "backuphost" -%> -moszumanska.debian.org 5432 debian-backup main 9.1 -<%- end -%> -# -# puppet notice: this is just a partial file. The tail EOF comes -# from a different concat fragment +done < '<%= scope['postgres::backup_server::globals::base_backup_clusters'] %> '