update systemd

This commit is contained in:
bigeagle 2014-10-18 23:57:05 +08:00
parent 8ddac716d5
commit b0e4648dc3
4 changed files with 9 additions and 5 deletions

View File

@ -13,7 +13,7 @@ max_retry = 2
[btrfs]
service_dir = {mirror_root}/{mirror_name}/_current
working_dir = {mirror_root}/{mirror_name}/_working
gc_dir = {mirror_root}/{mirror_name}/_gc_{timestamp}
gc_dir = {mirror_root}/{mirror_name}/_gc_{{timestamp}}
# rmirror:archlinux]

View File

@ -5,7 +5,7 @@ After = network.target
[Service]
Type=simple
ExecStart=/home/tuna/.virtualenvs/tunasync/bin/python -u /home/tuna/tunasync/tunasync_snapshot_gc.py %i
ExecStart=/home/tuna/.virtualenvs/tunasync/bin/python -u /home/tuna/tunasync/tunasync_snapshot_gc.py -c /etc/tunasync.ini
[Install]
WantedBy = multi-user.target

View File

@ -3,7 +3,6 @@ Description=TUNAsync GC every 10 minutes
[Timer]
OnUnitActiveSec=10min
Unit=tunasync-snapshot-gc@%i.service
[Install]
WantedBy=multi-user.target

View File

@ -3,13 +3,14 @@
import re
import sh
import os
import ConfigParser
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="tunasync_snapshot_gc")
parser.add_argument("--max-level", type=int, default=2, help="max walk level to find garbage snapshots")
parser.add_argument("--pattern", default=r"^_gc_\d+", help="pattern to match garbage snapshots")
parser.add_argument("mirror_root", help="tunasync mirror root")
parser.add_argument("-c", "--config", help="tunasync config file")
args = parser.parse_args()
@ -31,6 +32,10 @@ if __name__ == "__main__":
else:
walk(abs_fname, level+1)
walk(args.mirror_root)
settings = ConfigParser.ConfigParser()
settings.read(args.config)
mirror_root = settings.get("global", "mirror_root")
walk(mirror_root)
# vim: ts=4 sw=4 sts=4 expandtab