diff --git a/packaging/deb/DEBIAN-foundationdb-server/postinst b/packaging/deb/DEBIAN-foundationdb-server/postinst index 610b5dbf137..0ff48717917 100755 --- a/packaging/deb/DEBIAN-foundationdb-server/postinst +++ b/packaging/deb/DEBIAN-foundationdb-server/postinst @@ -29,24 +29,40 @@ if [ "$1" = configure ]; then chmod 0664 /etc/foundationdb/fdb.cluster NEWDB=1 fi - fi - # Start the service with systemd if it is available. - if pidof systemd > /dev/null; then - # Use deb-systemd-invoke if available to respect policy-rc.d. - systemctl=$(command -v deb-systemd-invoke || command -v systemctl) - systemctl --system daemon-reload > /dev/null || true - systemctl start foundationdb.service - else - /etc/init.d/foundationdb start - fi + # Start the service with systemd if it is available. + if pidof systemd > /dev/null; then + # Use deb-systemd-invoke if available to respect policy-rc.d. + systemctl=$(command -v deb-systemd-invoke || command -v systemctl) + systemctl --system daemon-reload > /dev/null || true + systemctl start foundationdb.service + else + /etc/init.d/foundationdb start + fi - if [ "$2" = "" ]; then update-rc.d foundationdb defaults if [ "$NEWDB" != "" ]; then /usr/bin/fdbcli -C /etc/foundationdb/fdb.cluster --exec "configure new single memory; status" --timeout 20 fi + else + DORESTART=1 + + if test -f /etc/foundationdb/owtech.conf; then + value=`grep -E "^RestartWhenUpdate" /etc/foundationdb/owtech.conf | awk -F "=" '{ print $2 }' | tr -d " " | tr "a-z" "A-Z"` + test "$value" = "NO" -o "$value" = "FALSE" -o "$value" = "0" && DORESTART=0 + fi + + if test $DORESTART -eq 1; then + if pidof systemd > /dev/null; then + # Use deb-systemd-invoke if available to respect policy-rc.d. + systemctl=$(command -v deb-systemd-invoke || command -v systemctl) + systemctl --system daemon-reload > /dev/null || true + systemctl condrestart foundationdb.service > /dev/null || true + else + /etc/init.d/foundationdb restart + fi + fi fi fi diff --git a/packaging/deb/DEBIAN-foundationdb-server/preinst b/packaging/deb/DEBIAN-foundationdb-server/preinst index eb678077b94..7b556be9135 100755 --- a/packaging/deb/DEBIAN-foundationdb-server/preinst +++ b/packaging/deb/DEBIAN-foundationdb-server/preinst @@ -10,7 +10,8 @@ # the debian-policy package if [ "$1" = upgrade ]; then - invoke-rc.d foundationdb stop || : + # XDB-130: Restart FDB now is conditional, so do not stop it here + # invoke-rc.d foundationdb stop || : # old versions could leave this behind rm -f /usr/lib/foundationdb/argparse.py /usr/lib/foundationdb/argparse.pyc fi diff --git a/packaging/rpm/foundationdb.spec.in b/packaging/rpm/foundationdb.spec.in index 5e618ea6dd1..6e8e96227de 100644 --- a/packaging/rpm/foundationdb.spec.in +++ b/packaging/rpm/foundationdb.spec.in @@ -86,7 +86,19 @@ ifdef(`RHEL6', ` /usr/bin/fdbcli -C /etc/foundationdb/fdb.cluster --exec "configure new single memory" --timeout 20 >/dev/null 2>&1 fi else -ifdef(`RHEL6', `/sbin/service foundationdb condrestart >/dev/null 2>&1', `/usr/bin/systemctl condrestart foundationdb >/dev/null 2>&1') + DORESTART=1 + if test -f /etc/foundationdb/owtech.conf; then + value=$(grep -E "^RestartWhenUpdate" /etc/foundationdb/owtech.conf | awk -F "=" '{ print $2 }' | tr -d " " | tr "a-z" "A-Z") + test "$value" = "NO" -o "$value" = "FALSE" -o "$value" = "0" && DORESTART=0 + fi + + if test $DORESTART -eq 1; then +ifdef(`RHEL6', ` + /sbin/service foundationdb condrestart >/dev/null 2>&1 +', ` + /usr/bin/systemctl condrestart foundationdb >/dev/null 2>&1 +') + fi fi exit 0