You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Portal:Toolforge/Admin/toolhistory

From Wikitech-static
< Portal:Toolforge‎ | Admin
Revision as of 19:21, 14 July 2017 by imported>BryanDavis (BryanDavis moved page Portal:Tool Labs/Admin/toolhistory to Portal:Toolforge/Admin/toolhistory: phab:T168480 rebranding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/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