From f9025ac53340a341b731dfed6821bde40b950e03 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 13 Apr 2014 21:38:55 +0200 Subject: add new scripts Signed-off-by: Florian Pritz --- ag-todos | 3 +++ remove-vm.sh | 13 +++++++++++++ syncrepo | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100755 ag-todos create mode 100755 remove-vm.sh create mode 100755 syncrepo diff --git a/ag-todos b/ag-todos new file mode 100755 index 0000000..ed6a0ae --- /dev/null +++ b/ag-todos @@ -0,0 +1,3 @@ +#!/bin/bash + +exec ag "(FIXME|TODO|XXX|HACK|BUG)" "$@" diff --git a/remove-vm.sh b/remove-vm.sh new file mode 100755 index 0000000..97f0161 --- /dev/null +++ b/remove-vm.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +name=$1 + +if [[ -z $name ]]; then + echo "usage: $0 "; + exit 0 +fi + +virsh destroy $name +virsh undefine $name +virsh vol-delete $name.img nfs + diff --git a/syncrepo b/syncrepo new file mode 100755 index 0000000..dd72a94 --- /dev/null +++ b/syncrepo @@ -0,0 +1,37 @@ +#!/bin/bash + +home="/srv" +target="${home}/repo" +tmp="${home}/tmp" +lock='/tmp/mirrorsync.lck' +bwlimit=4096 +#source='rsync://rsync.archlinux.org/ftp_tier1' +#lastupdate_url="http://rsync.archlinux.org/lastupdate" +source='mirror.pkgbuild.com::packages/' +lastupdate_url="http://mirror.pkgbuild.com/lastupdate" + +[ ! -d "${target}" ] && mkdir -p "${target}" +[ ! -d "${tmp}" ] && mkdir -p "${tmp}" + +exec 9>"${lock}" +flock -n 9 || exit + +if diff -b <(curl -s "$lastupdate_url") "$target/lastupdate" >/dev/null; then + exit 0 +fi + +if ! stty &>/dev/null; then + QUIET="-q" +fi + +rsync -rtlvH --safe-links --delete-after --progress -h ${QUIET} --timeout=600 --contimeout=60 -p \ + --delay-updates --no-motd --bwlimit=$bwlimit \ + --temp-dir="${tmp}" \ + --exclude='*.links.tar.gz*' \ + --exclude='/other' \ + --exclude='/sources' \ + --exclude='/iso' \ + ${source} \ + "${target}" + +#echo "Last sync was $(date -d @$(cat ${target}/lastsync))" -- cgit v1.2.3-24-g4f1b