Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions packaging/deb/DEBIAN-foundationdb-server/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion packaging/deb/DEBIAN-foundationdb-server/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion packaging/rpm/foundationdb.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down