45 lines
874 B
Bash
45 lines
874 B
Bash
#!/bin/sh
|
|
#
|
|
# This is not needed any more for the standard systemctl-supported actions,
|
|
# but we keep it around for the nonstandard actions (initdb, upgrade).
|
|
# People are too used to getting at those via "service postgresql foo ..."
|
|
|
|
# Find the name of the script
|
|
NAME=`basename $0`
|
|
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
|
|
then
|
|
NAME=${NAME:3}
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
systemctl start ${NAME}.service
|
|
;;
|
|
stop)
|
|
systemctl stop ${NAME}.service
|
|
;;
|
|
status)
|
|
systemctl status ${NAME}.service
|
|
;;
|
|
restart)
|
|
systemctl restart ${NAME}.service
|
|
;;
|
|
condrestart|try-restart)
|
|
systemctl try-restart ${NAME}.service
|
|
;;
|
|
reload)
|
|
systemctl reload ${NAME}.service
|
|
;;
|
|
initdb)
|
|
postgresql-setup initdb
|
|
;;
|
|
upgrade)
|
|
postgresql-setup upgrade
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|initdb|upgrade}"
|
|
exit 2
|
|
esac
|
|
|
|
exit $?
|