Jump to content

Portal:Toolforge/Admin/toolhistory

From Wikitech
#!/bin/bash

# Dump and commit the list of servicegroups to the repository at
# ~/var/lib/git/servicegroups hourly for backup and history.

# Abort on error.
set -e

# Loop forever.
while true; do
    TMPWC="$(mktemp -d)"
    git clone ~/var/lib/git/servicegroups "$TMPWC"
    cd "$TMPWC"
    ldaplist -l servicegroups > servicegroups.ldif
    git add servicegroups.ldif
    if git commit -m Snapshot; then
        git push
    fi
    cd
    rm -Rf "$TMPWC"

    # Sleep for an hour.
    sleep 1h
done