summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-06-27 09:47:55 +0200
committerErich Eckner <git@eckner.net>2021-06-27 09:47:55 +0200
commit778206e94bec853345ef04e936aba33ba9573c9e (patch)
tree0d02de070a200dd729779789424bbf2f39c96419
parentbbcb65e88d2ab04bf8e66445a8a785608e98015e (diff)
downloadprint-status-778206e94bec853345ef04e936aba33ba9573c9e.tar.xz
add config file
-rwxr-xr-xprint-status8
-rwxr-xr-xprint-status-html10
-rw-r--r--print-status.conf2
3 files changed, 12 insertions, 8 deletions
diff --git a/print-status b/print-status
index c2bdf8a..eaff49c 100755
--- a/print-status
+++ b/print-status
@@ -1,5 +1,7 @@
#!/bin/bash
+. /etc/print-status.conf
+
{
find /dev/mapper -mindepth 1 -maxdepth 1 \( -name 'leg*' -o -name 'foot*' \) -printf '%f\n' \
| sort -u \
@@ -38,9 +40,9 @@
| grep -v '^\s*$'
fi
} | \
- if mountpoint -q /srv/http/tmp; then
- sponge /srv/http/tmp/status
- date +%s > /srv/http/tmp/status.time
+ if mountpoint -q "${http_dir}"; then
+ sponge "${http_dir}/status"
+ date +%s > "${http_dir}/status.time"
else
cat
fi
diff --git a/print-status-html b/print-status-html
index 107647c..c82bfa0 100755
--- a/print-status-html
+++ b/print-status-html
@@ -1,6 +1,6 @@
#!/bin/bash
-watch_dirs=('/data/raid/harti')
+. /etc/print-status.conf
{
cat <<EOF
@@ -145,14 +145,14 @@ EOF
</table>
EOF
- if [ -f /srv/http/tmp/index.html ]; then
+ if [ -f "${http_dir}/index.html" ]; then
cat <<EOF
<table>
<tr><th>Name</th><th>Fortschritt</th><th>bisherige Gr&ouml;&szlig;e</th></tr>
EOF
- OUTPUT=/srv/http/tmp/index.html backup-progress \
+ OUTPUT="${http_dir}/index.html" backup-progress \
| tr -d '()' \
| awk '{print "<tr><td>" $1 "</td><td>" $2 " " $3 "</td><td>" $4 " " $5 "</td></tr>"}'
@@ -181,8 +181,8 @@ EOF
EOF
} | \
- if mountpoint -q /srv/http/tmp; then
- sponge /srv/http/tmp/index.html
+ if mountpoint -q "${http_dir}"; then
+ sponge "${http_dir}/index.html"
else
cat
fi
diff --git a/print-status.conf b/print-status.conf
index 5560886..69d4297 100644
--- a/print-status.conf
+++ b/print-status.conf
@@ -1,3 +1,5 @@
#!/bin/bash
http_dir='/srv/http/tmp'
+
+watch_dirs=('/data/raid/harti')