summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2018-09-10 18:54:13 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-09-10 18:54:13 +0200
commitfe1d2d7432847eba19ef80216de567fd7a914876 (patch)
tree2550af0d418b5ea20e501fc9badb68680be50021
parent5777f9515649ac48ba610cbbf26740cc77bb0531 (diff)
sfeed_update: reorder loadconfig and signal handler setup
... this is useful to change the interrupted behaviour in some use-cases. Thanks leot for the feedback.
-rwxr-xr-xsfeed_update16
1 files changed, 8 insertions, 8 deletions
diff --git a/sfeed_update b/sfeed_update
index 7578a1d..8ac5b32 100755
--- a/sfeed_update
+++ b/sfeed_update
@@ -97,30 +97,30 @@ feed() {
fi) &
}
-interrupted() {
- isinterrupted="1"
-}
-
cleanup() {
# remove temporary files
rm -rf "${sfeedtmpdir}"
}
+interrupted() {
+ isinterrupted="1"
+}
+
feeds() {
echo "Configuration file \"${config}\" is invalid or does not contain a \"feeds\" function." >&2
echo "See sfeedrc.example for an example." >&2
}
-# load config file.
-loadconfig "$1"
-# fetch feeds and store in temporary file.
-sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')"
# kill whole current process group on ^C (SIGINT).
isinterrupted="0"
# SIGTERM: signal to terminate parent.
trap -- "interrupted" "15"
# SIGINT: kill all running childs >:D
trap -- "kill -TERM -$$" "2"
+# load config file.
+loadconfig "$1"
+# fetch feeds and store in temporary file.
+sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')"
# make sure path exists.
mkdir -p "${sfeedpath}"
# fetch feeds specified in config file.