2014-03-14 15:30:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Restart SERVICE only if PACKAGE is installed.
|
|
|
|
# We use this throughout handlers/restart_services.yml
|
|
|
|
|
|
|
|
SERVICE=$1
|
|
|
|
PACKAGE=$2
|
|
|
|
|
2014-05-21 13:06:17 +00:00
|
|
|
rpm -q $PACKAGE
|
2014-03-14 15:30:32 +00:00
|
|
|
|
|
|
|
INSTALLED=$?
|
|
|
|
|
|
|
|
if [ $INSTALLED -eq 0 ]; then
|
2014-12-08 13:46:23 +00:00
|
|
|
echo "Package $PACKAGE installed. Attempting restart of $SERVICE."
|
|
|
|
/sbin/service $SERVICE restart
|
|
|
|
exit $? # Exit with the /sbin/service status code
|
2014-03-14 15:30:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If the package wasn't installed, then pretend everything is fine.
|
|
|
|
echo "Package $PACKAGE not installed. Skipping restart of $SERVICE."
|
|
|
|
exit 0
|