When working with such problems, the server needs to switch from root to PostgreSQL to install the user to start the PostgreSQL service.
The switch user and start PostgreSQL commands are as follows:
# Switch to Pgsql user su postgres# starting Pg_ctl start -bash:pg_ctl:command not found
Hint that the PG_CTL command does not exist, but it is certain that the previous installation of PostgreSQL is so started, how can not this time.
Later learned that the original is the question of the SU command, there is no horizontal bar "-" There is a difference.
su - Postgres
There are bars login shell: User switch, change working directory, load all user environment configuration.
No bar interactive shell: The user switches, but the working directory does not switch to the user's working directory, and the environment variables set by the user are not loaded.
"When Bash starts executes the commands in a variety of different scripts.
(1) When started as an interactive login Shell:bash reads and executes The/etc/profile (if it exists). After reading. File, it looks for
~/.bash_profile, ~/.bash_login, and ~/.profile in this order, and reads and executes the first one (that's exists and is Rea dable). When a login shell
Exits:bash reads and executes ~/.bash_logout (if it exists).
(2) When the started as an interactive shell (but not a login shell): Bash reads and executes ~/.BASHRC (if it exists). "
Linux operation, the difference between the "-" and "-" in the SU Switch User command