Server IP : 192.168.23.10 / Your IP : 3.145.12.233 Web Server : Apache System : Linux echo.premieradvertising.com 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 7 14:54:22 EST 2023 x86_64 User : rrrallyteam ( 1049) PHP Version : 8.1.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0555) : /home/../sbin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#!/usr/bin/bash # Automatically create systemd unit for PostgreSQL service. set -e . "/usr/share/postgresql-setup/library.sh" USAGE_STRING=$"\ Usage: $0 --unit SYSTEMD_UNIT --datadir DATADIR Automatically create systemd unit for PostgreSQL service. For more info and howto/when use this script please look at the documentation file /usr/share/doc/postgresql/README.rpm-dist. Options: --unit=UNIT_NAME The name of new systemdunit, of form postgresql@<string>, will generate service file postgresql@<string>.service. --datadir=DATADIR Where the data will be stored. The postgres user needs to have permissions to create this directory. " root_prereq opt_unit=default opt_datadir=default test $# -ne 0 || { echo >&2 "$USAGE_STRING" exit 1 } args=$(getopt -o "" -l "datadir:,unit:,help,version" -n "$0" -- "$@") || exit 1 eval set -- "$args" while true; do case "$1" in --datadir|--unit) opt=${1##--} opt=${opt##-} opt=${opt//-/_} eval "opt_$opt=\$2" shift 2 ;; --help) echo "$USAGE_STRING" exit 0 ;; --version) echo "postgresql-new-systemd-unit 8.6" echo $"Built against PostgreSQL version 13.18." exit 0 ;; --) # end! shift break ;; *) echo "programmer mistake ($1)" >&2 exit 1 ;; esac done required_ok=: for opt in unit datadir; do if eval "test \"\$opt_$opt\" == default"; then required_ok=false error "option --$opt required" fi done $required_ok || die "missing argument" case $opt_unit in *.service) opt_unit=${opt_unit%%.service} ;; esac case $opt_unit in postgresql@*) ;; *) die "the --unit needs to start with 'postgresql@', e.g. 'postgresql@second'" ;; esac exit_handler() { test -z "$cleanup_dropin" || { info "cleaning up created dropin directory" eval "$cleanup_dropin" } } cleanup_dropin= trap exit_handler 0 dropindir="/etc/systemd/system/$opt_unit.service.d" dropin="$dropindir/30-postgresql-setup.conf" test ! -e "$dropindir" \ || die "The systemd drop-in directory '$dropindir' already exists" mkdir -p "$dropindir" \ || die "Can not create '$dropindir'" cleanup_dropin="rm -rf \"$dropindir\"" generate_dropin () { cat <<EOF > "$1" [Service] Environment=PGDATA=$opt_datadir EOF } generate_dropin "$dropin" || die "Can not write to '$dropin'" reload_systemd="systemctl daemon-reload" $reload_systemd || die $"Can not perform '$reload_systemd'" parentdir=$(dirname "$opt_datadir") if ! /usr/sbin/runuser -s /bin/sh -l postgres -c "test -w $(printf %q "$parentdir")"; then error "The '$parentdir' directory doesn't exit or 'postgres' can not" error_q "write there. Please either fix the permissions or change the" error_q "configuration in dropin directory before trying again." exit 1 fi info $"The '$opt_unit.service' configured in '$dropindir' directory." cleanup_dropin=