How to run PGadmin as service in windows server? - postgresql

I am able to run PGadmin version 4.4 as a desktop application. Is it possible to run the PGadmin as a service in windows so I can access the PGadmin web portal as a different user.
This is needed for the automation purposes.
Thanks
Karthik

run the following from admin cmd prompt:
sc.exe create PGAdmin4 binpath= "C:\Program Files\PostgreSQL\12\pgAdmin 4\bin\pgAdmin4.exe"
please ensure the "binpath" is correct for your environment

Related

Unable to install pgagent with application stack builder

I'm trying to install pgagent in a windows environment. Postgresql version 9.6 is installed and application stack builder was installed with it. I have followed the steps, detailed here.
The first step in this guide is to create the extension in the maintenance db, and I am not able to do that.
"ERROR: could not open extension control file "C:/Program Files/PostgreSQL/9.6/share/extension/pgagent.control": No such file or directory
SQL state: 58P01"
Tryied to skip this step and go straight to the installation with application stack builder, but the pgAgent tool does not show up.
I also tried to install it as a service using the command line instead of stack builder.
pgAent.exe INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=postgres user=postgres
This worked to some degree. The only error I get is this.
"Windows could not start pgAgent service on the local computer. Error 1069: The service did not start due to a logon failure."
But I have tried all possible combinations of usernames, passwords, secrets, ports and so on....
Any help would be much appreciated.
I had the same problem. I was able to get pgagent working by downloading and executing the stand-alone installation file pgagent-3.4.0-4-windows.exe from here: http://sbp.enterprisedb.com/getfile.jsp?fileid=11842
I wound up installing the Stack Builder Plus from EDB. Unfortunately, you have to create an account, but it has a lot more options for which pgAgent version you want. Note: You can use Stack Builder for only pulling a pgAgent installation executable and run that on your target servers.
this worked for me :
first I accessed the postgres bin file using cmd: C:\Program Files\PostgreSQL\11\bin
then i tapped this :
pgAgent INSTALL pgAgent -u windowsUser-p windowspassword hostaddr=127.0.0.1 dbaname=postgres user=postgres password=***
Have you choosen a localy installed database before this step ?
You will need to have installed PostgresSql, CLI Commands and Stackbuilder to have the option of installing pgAgent via those eDB installers.

How can I confirm that Postgres had been installed properly for Heroku use?

I am using Heroku and thus the Postgres is needed to be properly installed.
I used the Windows Installer "postgresql-10.1-3-windows-x64.exe" for my installation, and there was not special interruption during the installation.
However, after I deployed a Heroku app on web, and try to run ">pipenv --three" in my cmd windows, there's a message of ' "command" is not recognized as an internal or external command, operable program or batch file.', which make me not sure whether Postgres is properly installed.
I also tried to run the command "heroku pg:psql", and the result is as below:-
heroku pg:psql
Is that really because the Postgres is not properly installed, and how can I get it fixed? Thank you in advance for the help!
Environment:-
Windows 10 Home - 64-bit
Postgre Installer: postgresql-10.1-3-windows-x64.exe
Heroku: heroku-cli/6.15.18-fd2097 (win32-x64) node-v9.3.0
I finally got it solved, by adding the following into the $PATH.
%APPDATA%\Python\Python36\Scripts
It's not the matter of the installation.
Thx.

ssh not working for Amazon EC2 server

I have setup and launched an instance of Amazon EC2 server with Ubuntu in it. Now I have integrated cygwin with command prompt also so all linux commands are working in command prompt.
I tried to access the server using ssh -i munish.pem ubuntu#52.11.190.155 (munish.pem contains my secret key).
After running this command I get an error: 'ssh' is not recognized as an internal or external command, operable program or batch file. I searched net and could find solution for github not for Amazon EC2 service...
You can use putty software in window for connecting to the AWS EC2 instance.
Follow the below steps:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
Hope it helps..
You can open PowerShell and check ssh command is available or not.
If not, you can install OpenSSH in Windows 10. See following guide on how to install it.
https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

Install windows service with PsExec?

Is it possible to remotely install a Windows system serive using PsExec? The files are already on the remote system; I am trying to use
psexec \\remote-host-name -u myusername -p mypassword PathToExecutable
where PathToExecutable is the path to some executable which is intended to install the service; somehow the service is not installed due to unclear reasons. Is remote installation via PsExec possible at all?
In my case, the issue was fixed by using the command line parameter:
-h If the target system is Vista or higher, has the process
run with the account's elevated token, if available.
to run the command with administrator permissions.

Restart PostgreSQL Remotely

Can I remotely restart a PostgreSQL server throught PGAdmin ? The user I currently is the administrative privileges.
Regards,
Dino
I don't think there is such possibility. At best you can reload connected PostgreSQL server using pg_reload_conf() function:
pg_reload_conf sends a SIGHUP signal
to the server, causing configuration
files to be reloaded by all server
processes.
Command:
SELECT pg_reload_conf();
You can also install adminpack contrib module and reload server using Tools menu.
EDIT:
According to pgAdmin documentation:
If pgAdmin is running on a Windows
machine, it can control the postmaster
service if you have enough access
rights. Enter the name of the service.
In case of a remote server, it must be
prepended by the machine name (e.g.
PSE1\pgsql-8.0). pgAdmin will
automatically discover services
running on your local machine.
If pgAdmin is running on a Unix
machine, it can control processes
running on the local machine if you
have enough access rights. Enter a
full path and needed options to access
the pg_ctl program. When executing
service control functions, pgAdmin
will append status/start/stop keywords
to this. Example: sudo
/usr/local/pgsql/bin/pg_ctl -D
/data/pgsql
You can try use Start Service/Stop Service options (in Tools menu) to restart remote server.