Do you want to choose a different one? Solution a few days ago, the company needs to install the Postgresql database and add it to the Linux Service. Some scripts are as follows: case $1 in start) echo-n "Starting PostgreSQL: "su-$ PGUSER-c" $ DAEMON-D '$ pgdata' & ">>$ PGLOG 2> & 1 echo" OK "; stop) echo-n "Stopping PostgreSQL:" su-$ PGUSER-c "$ PGCTL stop-D '$ PGDATA'-s-m fast" echo "OK"; restart) echo-n "Restarting PostgreSQL: "su-$ PGUSER-c" $ PGCTL stop-D '$ PGDATA'-s-m fast-w "su-$ PGUSER-c" $ DAE MON-D '$ pgdata' & "> $ PGLOG 2> & 1 echo" OK "; reload) echo-n" Reload PostgreSQL: "su-$ PGUSER-c" $ PGCTL reload-D '$ PGDATA'-s "echo" OK "; status) su-$ PGUSER-c "$ PGCTL status-D '$ pgdata'"; *) # Print help echo "Usage: $0 {start | stop | restart | reload | status} "1> & 2 exit 1; *) in Linux, it is normal to start with the service command, however, the service cannot be started after the system is restarted. Later I found that Postgresql's log contains the following sentence: Do you want to choose a different one? At the beginning, I couldn't understand it. Later I found that the system started SELinux and checked it online. Some Linux releases of SELinux were not very friendly to the su user-c command. Later, I used the runuser command to solve the problem. The modified script is as follows: case $1 in start) echo-n "Starting PostgreSQL: "runuser-s/bin/bash $ PGUSER-c" $ DAEMON-I-D '$ pgdata' & ">>$ PGLOG 2> & 1 echo" OK ";; stop) echo-n "Stopping PostgreSQL: "runuser-s/bin/bash $ PGUSER-c" $ PGCTL stop-D '$ PGDATA'-s-m fast "echo" OK "; restart) echo-n "Restarting PostgreSQL: "runuser-s/bin/bash $ PGUSER-c" $ PGCTL stop-D '$ PGDATA'-s-m fast-w "runuser-s/bin/bash $ PGUSER- c "$ DAEMON-I-D '$ pgdata' &"> $ PGLOG 2> & 1 echo "OK ";; reload) echo-n "Reload PostgreSQL:" runuser-s/bin/bash $ PGUSER-c "$ PGCTL reload-D '$ PGDATA'-s" echo "OK ";; status) runuser-s/bin/bash $ PGUSER-c "$ PGCTL status-D '$ pgdata '";;*)