在erlang升级期间是否可以阻止rabbitmq-server重启?
正如我们在erlang升级期间所知,将调用erlang-base.prerm脚本。
此脚本将检查是否有任何依赖于erlang的其他服务。
如果有的话。它将尝试停止服务,并在erlang升级完成时重新开始。
case "$1" in
remove|upgrade)
echo -n "Searching for services which depend on erlang and should be stopped..."
# find all init scripts and packages they belong
inits=$(dpkg -S '/etc/init.d/*' 2>/dev/null | sed -e's:/etc/init.d/::')
# filter the list of the packages
packs=$(echo $inits | sed -e's/:[[:space:]]\+[^[:space:]]*//g' | sed -e's/ /\n/g' | sort -u)
# find packages, which depend on erlang
packs=$(dpkg -s $packs 2>/dev/null | egrep '^Package:|^Status:|^Depends' | awk '{if ($1 ~ /^Package:/) {package=$2;inst=0} else if ($0 ~ /^Status:.* installed$/) {inst=1} else if ((inst==1) && ($0 ~ /^Depends:.* erlang/)) {print package}}')
# construct services list from the packages
services=""
for p in $packs ; do
service=$(echo $inits | sed -e's/\([^:]\) /\1\n/g' | awk "/^$p:/ {print \$2}")
services="$services $service"
done
services=$(echo $services | tr '\n' ' ' | sed -e's/\(^[[:space:]]*\|[[:space:]]*$\)//g')
if [ -z "$services" ] ; then
echo "none found."
else
echo "found: $services."
echo "Stopping services which depend on erlang"
rl=$(runlevel | awk '{print $2}')
failed=""
for service in $services ; do
if [ -f /usr/share/file-rc/rc -o -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ] ; then
idl=$(filerc $rl $service)
else
idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -1)
fi
if [ -n "$idl" ] ; then
echo -n " $service: stopping..."
if $idl stop > /dev/null 2>&1 ; then
echo "done."
else
echo "failed. ($?)"
failed="$failed $service"
fi
fi
有没有办法防止这种情况发生?我想手动重启rabbitmq-server ..