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

57 lines
1.4 KiB
Plaintext
Raw Normal View History

2017-03-28 04:34:52 +02:00
#!/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..."
2018-06-13 05:19:31 +02:00
2018-06-13 05:25:57 +02:00
# 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
2018-06-14 18:55:45 +02:00
su - postgres -c '/usr/bin/initdb -E UTF8 -D /srv/pgsql/data'
2018-06-13 05:25:57 +02:00
fi
2017-03-28 04:34:52 +02:00
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