As mentioned in the error message, you can not run the command as root user. Please run the command below to know which user is running PostgreSQL
sudo ps aux | grep postgresql |
And then run:
sudo su the_username_you_get -c "/opt/bitnami/postgresql/bin/pg_ctl stop -D"
If it does not works, I recommend you to use the other command that @davidg suggested
pkill -f -9 postgresql
The command above should stop PostgreSQL so then you could use the
ctlscript.sh located in
/opt/bitnami to start PostgreSQL server.
You can find more information about how to start/stop services using our guide at https://wiki.bitnami.com/Applications/BitNami_Discourse#How_to_start.2fstop_the_servers.3f
Please, do not hesitate to write us back in case you have any other issue.