Skip to content

Commit

Permalink
Use inline check
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamek committed Jun 12, 2018
1 parent b22ea51 commit d8b5d1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 8 additions & 6 deletions archlinux/blacklist.install
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ post_upgrade() {
$APP_NAME migrations upgrade
systemctl daemon-reload
# Restart service only when is active or enabled
systemctl is-active --quiet $APP_NAME || systemctl is-enabled --quiet $APP_NAME
if [ $? -eq 0 ]; then
if systemctl is-active --quiet $APP_NAME || systemctl is-enabled --quiet $APP_NAME; then
echo "Restarting ${APP_NAME} service"
systemctl restart $APP_NAME
fi
systemctl is-active --quiet "${APP_NAME}_celeryworker" || systemctl is-enabled --quiet "${APP_NAME}_celeryworker"
if [ $? -eq 0 ]; then

if systemctl is-active --quiet "${APP_NAME}_celeryworker" || systemctl is-enabled --quiet "${APP_NAME}_celeryworker"; then
echo "Restarting ${APP_NAME}_celeryworker service"
systemctl restart "${APP_NAME}_celeryworker"
fi
systemctl is-active --quiet "${APP_NAME}_celerybeat" || systemctl is-enabled --quiet "${APP_NAME}_celerybeat"
if [ $? -eq 0 ]; then

if systemctl is-active --quiet "${APP_NAME}_celerybeat" || systemctl is-enabled --quiet "${APP_NAME}_celerybeat"; then
echo "Restarting ${APP_NAME}_celerybeat service"
systemctl restart "${APP_NAME}_celerybeat"
fi
}
Expand Down
15 changes: 9 additions & 6 deletions debian/python3-blacklist.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,19 @@ case "$1" in
$APP_NAME migrations upgrade
systemctl daemon-reload
# Restart service only when is active or enabled
systemctl is-active --quiet $APP_NAME || systemctl is-enabled --quiet $APP_NAME
if [ $? -eq 0 ]; then

if systemctl is-active --quiet $APP_NAME || systemctl is-enabled --quiet $APP_NAME; then
echo "Restarting ${APP_NAME} service"
systemctl restart $APP_NAME
fi
systemctl is-active --quiet "${APP_NAME}_celeryworker" || systemctl is-enabled --quiet "${APP_NAME}_celeryworker"
if [ $? -eq 0 ]; then

if systemctl is-active --quiet "${APP_NAME}_celeryworker" || systemctl is-enabled --quiet "${APP_NAME}_celeryworker"; then
echo "Restarting ${APP_NAME}_celeryworker service"
systemctl restart "${APP_NAME}_celeryworker"
fi
systemctl is-active --quiet "${APP_NAME}_celerybeat" || systemctl is-enabled --quiet "${APP_NAME}_celerybeat"
if [ $? -eq 0 ]; then

if systemctl is-active --quiet "${APP_NAME}_celerybeat" || systemctl is-enabled --quiet "${APP_NAME}_celerybeat"; then
echo "Restarting ${APP_NAME}_celerybeat service"
systemctl restart "${APP_NAME}_celerybeat"
fi
fi
Expand Down

0 comments on commit d8b5d1e

Please sign in to comment.