milis/ayarlar/servisler/mbd/init.d/postgresql

59 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
### BEGIN INIT INFO
# Provides: PostgreSQL
# Required-Start: $network
# Should-Start: $remote_fs
# Required-Stop: $network
# Should-Stop: $remote_fs
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts PostgreSQL server.
# Description: Starts PostgreSQL server.
# X-LFS-Provided-By: BLFS / LFS 7.0
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_info_msg "Starting PostgreSQL daemon..."
# ilk başlatma ayarları
if [ ! -d /srv/pgsql/data ];then
install -v -dm700 /srv/pgsql/data
install -v -dm755 /run/postgresql
chown -Rv postgres:postgres /srv/pgsql /run/postgresql
su - postgres -c '/usr/bin/initdb -E UTF8 -D /srv/pgsql/data'
fi
mkdir -p /run/postgresql
chown -Rv postgres:postgres /run/postgresql
su - postgres -c '/usr/bin/pg_ctl start -W -D /srv/pgsql/data \
-l /srv/pgsql/data/logfile -o "-i" '
evaluate_retval
;;
stop)
log_info_msg "Stopping PostgreSQL daemon..."
su - postgres -c "/usr/bin/pg_ctl stop -m smart -D /srv/pgsql/data"
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
su - postgres -c "/usr/bin/pg_ctl status -D /srv/pgsql/data"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
# End /etc/init.d/postgresql