handle curl errors, pass exit status along
This commit is contained in:
parent
95d0b230e2
commit
9c631e813f
10
meow.sh
10
meow.sh
|
@ -54,6 +54,7 @@ groupfilter() { # groupname regex [timestamp]
|
||||||
groupreleases "$1" "${3:-}" | while IFS=$SEP read -r title torrent; do
|
groupreleases "$1" "${3:-}" | while IFS=$SEP read -r title torrent; do
|
||||||
grep -P "$2" <<< "$title" 1>/dev/null && echo "$title$SEP$torrent"
|
grep -P "$2" <<< "$title" 1>/dev/null && echo "$title$SEP$torrent"
|
||||||
done
|
done
|
||||||
|
[ ${PIPESTATUS[0]} = 0 ] || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
@ -62,13 +63,14 @@ cleanup() {
|
||||||
echo "touchgroup $gs $v" >> times.sh
|
echo "touchgroup $gs $v" >> times.sh
|
||||||
[ -e "$gs.xml" ] && rm "$gs.xml"
|
[ -e "$gs.xml" ] && rm "$gs.xml"
|
||||||
done
|
done
|
||||||
exit 0
|
exit ${1:-1}
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: optionally buffer lists so interrupting and restarting wont give the same output
|
# TODO: optionally buffer lists so interrupting and restarting wont give the same output
|
||||||
|
|
||||||
runall() {
|
runall() {
|
||||||
trap cleanup INT
|
trap cleanup INT
|
||||||
|
ret=0
|
||||||
|
|
||||||
local insane regex timestamp now
|
local insane regex timestamp now
|
||||||
for gs in "${!groupshows[@]}"; do
|
for gs in "${!groupshows[@]}"; do
|
||||||
|
@ -76,9 +78,9 @@ runall() {
|
||||||
regex="${groupshows[$gs]:1}"
|
regex="${groupshows[$gs]:1}"
|
||||||
timestamp="${grouptimes[$gs]}"
|
timestamp="${grouptimes[$gs]}"
|
||||||
now="$(date -u '+%s')"
|
now="$(date -u '+%s')"
|
||||||
groupfilter "$insane" "$regex" "$timestamp"
|
( groupfilter "$insane" "$regex" "$timestamp" )
|
||||||
touchgroup "$gs" "$now"
|
[ $? = 0 ] && touchgroup "$gs" "$now" || ret=1
|
||||||
done
|
done
|
||||||
|
|
||||||
cleanup
|
cleanup $ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user