blob: f95ef741d745acacb274f940740b60c910a3c51b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/bash
# Restart SERVICE only if PACKAGE is installed.
# We use this throughout handlers/restart_services.yml
SERVICE=$1
PACKAGE=$2
rpm -q $PACKAGE
INSTALLED=$?
if [ $INSTALLED -eq 0 ]; then
echo "Package $PACKAGE installed. Attempting restart of $SERVICE."
/sbin/service $SERVICE restart
exit $? # Exit with the /sbin/service status code
fi
# If the package wasn't installed, then pretend everything is fine.
echo "Package $PACKAGE not installed. Skipping restart of $SERVICE."
exit 0
|