Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
212
/
root
/
srv
/
admin
/
scripts
/
init.d
/
//proc/212/root/srv/admin/scripts/init.d/pgsql
#!/bin/bash # Enable errexit option: this explains why we almost never check return values. # We want this script to exit (with exitcode > 0) if anything goes wrong. set -e . /lib/start-lib.sh NAME=postgresql PGSQL_PATH="/opt/postgresql-${DB_VERSION}" DAEMONCTL=${PGSQL_PATH}/bin/pg_ctl PGSQL_CONF="$CUSTOMER_DIR/.config/pgsql-${DB_VERSION}" PGSQL_DATA="$CUSTOMER_DIR/db/pgsql" PGSQL_OPTS="" _pg_ctl() { # assign conf directory to -D; pgsql will find data with the configuration file do_as "$DB_USER" "$DAEMONCTL" "$@" -D "$PGSQL_CONF" -o "$PGSQL_OPTS" } do_setup() { [ -d "$LOCAL_DIR/pgsql" ] || \ do_as "$DB_USER" install -d "$LOCAL_DIR/pgsql" do_as "$DB_USER" "$DAEMONCTL" initdb -o "-U $DB_USER" -D "$PGSQL_DATA" || true # clean configuration files generated by initdb; it will be never used do_as "$DB_USER" find "$PGSQL_DATA" -name "*.conf" -delete # avoid annoying log message with pgsql 9.4 do_as "$DB_USER" touch "$PGSQL_DATA/postgresql.auto.conf" } do_start() { _pg_ctl start -w -t 20 -s } do_stop() { _pg_ctl stop -w -t 20 -m fast -s } do_reload() { _pg_ctl reload -s } do_status() { _pg_ctl > /dev/null status } case "$1" in start) echo "Starting $NAME" do_setup do_start ;; stop) echo "Stopping $NAME" do_stop ;; reload) ;; status) do_status ;; *) echo "Usage: $0 {start|stop|reload|status}" exit 1 ;; esac