1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-18 13:55:44 +02:00

Merge branch 'master' into subvol-threads

This commit is contained in:
Zygo Blaxell 2017-10-01 15:24:02 -04:00
commit b9dc4792bc
5 changed files with 34 additions and 10 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ html/
latex/
make.log
make.log.new
localconf

View File

@ -1,4 +1,11 @@
PREFIX ?= /
LIBEXEC_PREFIX ?= $(PREFIX)/usr/lib/bees
MARKDOWN := $(shell which markdown markdown2 markdown_py 2>/dev/null)
MARKDOWN ?= markdown
# allow local configuration to override above variables
-include localconf
MARKDOWN := $(shell which markdown markdown2 markdown_py 2>/dev/null)
MARKDOWN ?= markdown
@ -21,6 +28,9 @@ test: ## Run tests
test: lib src
$(MAKE) -C test
scripts/beesd: scripts/beesd.in
sed -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' -e's#@PREFIX@#$(PREFIX)#' "$<" >"$@"
README.html: README.md
$(MARKDOWN) README.md > README.html.new
mv -f README.html.new README.html
@ -28,10 +38,11 @@ README.html: README.md
install: ## Install bees + libs
install: lib src test
install -Dm644 lib/libcrucible.so $(PREFIX)/usr/lib/libcrucible.so
install -Dm755 bin/bees $(PREFIX)/usr/bin/bees
install -Dm755 bin/bees $(LIBEXEC_PREFIX)/bees
install_scripts: ## Install scipts
install -Dm755 scripts/beesd $(PREFIX)/usr/bin/beesd
install_scripts: scripts/beesd
install -Dm755 scripts/beesd $(PREFIX)/usr/sbin/beesd
install -Dm644 scripts/beesd.conf.sample $(PREFIX)/etc/bees/beesd.conf.sample
install -Dm644 scripts/beesd@.service $(PREFIX)/lib/systemd/system/beesd@.service

View File

@ -2,8 +2,11 @@
## https://github.com/Zygo/bees
## It's a default values, change it, if needed
# How to use?
# Copy this file to a new file name and adjust the UUID below
# Which FS will be used
UUID=5d3c0ad5-bedf-463d-8235-b4d4f6f99476
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
## System Vars
# Change carefully

View File

@ -1,5 +1,4 @@
#!/bin/bash
# /usr/bin/beesd
## Helpful functions
INFO(){ echo "INFO:" "$@"; }
@ -13,15 +12,15 @@ export CONFIG_FILE
export UUID AL16M
readonly AL16M="$((16*1024*1024))"
readonly CONFIG_DIR=/etc/bees/
readonly CONFIG_DIR=@PREFIX@/etc/bees/
## Pre checks
{
[ ! -d "$CONFIG_DIR" ] && ERRO "Missing: $CONFIG_DIR"
[ "$UID" == "0" ] || ERRO "Must be runned as root"
[ "$UID" == "0" ] || ERRO "Must be run as root"
}
command -v bees &> /dev/null || ERRO "Missing 'bees' command"
command -v @LIBEXEC_PREFIX@/bees &> /dev/null || ERRO "Missing 'bees' agent"
## Parse args
UUID="$1"
@ -123,6 +122,6 @@ filter_path(){
fi
}
bees "$MNT_DIR" 3>&1 2>&1 | filter_time | filter_path
@LIBEXEC_PREFIX@/bees "$MNT_DIR" 3>&1 2>&1 | filter_time | filter_path
exit 0

View File

@ -3,12 +3,22 @@ Description=Bees - Best-Effort Extent-Same, a btrfs deduplicator daemon: %i
After=local-fs.target
[Service]
ExecStart=/usr/bin/beesd %i
Type=simple
ExecStart=/usr/sbin/beesd %i
Nice=19
KillMode=control-group
KillSignal=SIGTERM
CPUShares=128
StartupCPUShares=256
BlockIOWeight=100
StartupBlockIOWeight=250
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUSchedulingPolicy=batch
Nice=19
Restart=on-abnormal
CPUAccounting=true
MemoryAccounting=true
# CPUQuota=95%
[Install]
WantedBy=local-fs.target