summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2017-12-12 17:50:44 +0000
committerLuke Bratch <luke@bratch.co.uk>2017-12-12 17:50:44 +0000
commit84775ad2577564414d81a053957662ab9d7ed05e (patch)
treecaadab26870c1e5d481cd283e4adfe25208b5cdc
parent54e0b26f2fb9e1829941b12daf372cf0619682e5 (diff)
Only restart services if the safe list grep matched (this was a bad bug!)
-rwxr-xr-xportage-update.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/portage-update.sh b/portage-update.sh
index 0a1c807..02e31de 100755
--- a/portage-update.sh
+++ b/portage-update.sh
@@ -54,8 +54,10 @@ revdep-rebuild -- -av || exit 1
DELETED=$(lsof -n | grep "DEL\|deleted")
for service in ${SAFE_SERVICES[@]}; do
echo "$DELETED" | grep -Eq "^$service\s+[0-9]"
- echo "/etc/init.d/$service restart"
- /etc/init.d/"$service" restart || exit 1
+ if [ "$?" -eq 0 ]; then
+ echo "/etc/init.d/$service restart"
+ /etc/init.d/"$service" restart || exit 1
+ fi
done
# Print any remaining processes that have open but deleted files