Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

96 lines (72 sloc) 1.928 kb
#! /bin/sh
# This script abstracts the reload function so that service
# installs do not need to know the nitty gritty of how the
# plutonManager is managed.
# This script (mostly) only exists because you cannot nest yinst
# commands with yinst (This is a Yahoo-ism that is otherwise
# irrelevant).
args=`getopt a $*`
if [ $? != 0 ]
then
echo 'Usage: plReloadManager [-a]'
exit 2
fi
reloadAll=n
set -- $args
for f
do
case "$f" in
-a)
reloadAll=y
shift;;
*)
shift;;
--)
break;;
esac
done
# Check that the user can issue the svc command
id=`id -un`
if [ $id != 'yahoo' -a $id != 'root' ]; then
cat <<EOF
WARNING: You are running as user $id but normally this command is only
WARNING: effective when running as 'yahoo' or 'root'. It is likely
WARNING: this command will fail, but we're proceeding anyway, just in
WARNING: case you know something we don't...
EOF
fi
# Find that pesky service directory containing the plutonManager
foundit=
for d in /service /etc/service /var/service /usr/local/var/service
do
p=$p/plutonManager
if [ -d $p ]; then
echo Manager service found at $p
foundit=$p
if [ $reloadAll = 'y' ]; then
echo Reload All
svc -i $p
else
echo Reload Changed
svc -h $p
fi
break;
fi
done
# Bug. svc doesn't exit non-zero on failure! Bah humbug djb - a rare
# oversight on your part.
if [ "$foundit" ]; then
cat <<EOF
The plutonManager at $foundit has been notified to reload its configuration.
Do not expect configuration changes to be instantaneous as the
plutonManager patiently waits for active services to finish. In the
worst case, the plutonManager can wait for over twelve seconds before
uncremoniously evicting a recalcitrant service.
EOF
exit
fi
cat <<EOF
ERROR: Could not find the service path for the plutonManager. Reload
ERROR: not performed.
EOF
exit 1
Jump to Line
Something went wrong with that request. Please try again.