Paste (Python) Web Server - Autoreload Problem - webserver

When I start the `Paste' web server in daemon mode, it seems to kill off it's ability to reload when the timestamp of a source file is updated.
Here is how I start the daemon...
cd ${project} && ../bin/paster serve --reload --daemon development.ini; cd ..;
...which defeats one of the main points of using Paste (for me).
Has anyone come across this or know what I'm doing wrong?
To be complete, the file that I'm changing is a controller file.
The version is `PasteScript 1.7.3'

I believe that the two options are essentially incompatible, since the reloader stops the server with a SIGTERM and the daemon-ized server is impervious to that -- and since daemon is intended for running in a production environment, and reload for a development/debugging environment, I guess that their incompatibility is not seen as a big loss. I imagine a customized reloader, tailored to properly stop and restart the daemonized server, could certainly be developed, but I don't know of any existing one.

I had a similar problem and circumvented the problem. I currently have paster running on a remote host, but I am still developing, so I needed a means to restart paster, but manually by hand was too time consuming, and daemon didnt work. So I always had to keep a shell window open to the server and running paster without --daemon in there. Once I finished my work for that day, and i closed the shell, paster died, which is bad.
I circumvented that by running paster non daemonized in a "screen".
Simply type "screen" in your shell of choice, you will usually depending on your linux be presented with a virtual terminal, that will keep running even when you log out your remote session. Start paster as usually in your new "window" (the screen) with --reload but without daemon, and then detach the window, so you can return to your normal shell (detach = CTRL-A, then press D). You can re-enter that screen by typing "screen -r". If you would like to kill it, reconnect it (screen -r) and inside the screen type CTRL-A, then press K.
Hope that helps.

Related

KeePassXC won't add keys the running SSH agent when started from the gnome shell

I am running on Pop!_OS so for most things this is likely an aquivalent of Ubuntu.
KeepassXC is installed and the SSH-Agent is enabled.
There is a keyphrase configured with a key and it works just like a charm when I start keepassxc from the terminal keepassxc log in and then I can see that ssh-add -l lists an additional key. It also vanishes once I close KeePassXC. Perfect!
Now I start keypassXC from the gnome shell, hit the super key, search for keepassXC and log into its vault. Looking at ssh-add -l in the terminal: Nothing. No keys added. 😔
Now I took a look at /usr/share/applications/org.keepassxc.KeePassXC.desktop and changed Terminal=false to true. No, sadly not that easy.
My guess that it has something to do how the gnome shell starts KeePassXC, but can't say for sure what the problem is. Anyone got a clue what that could be or how to take a shot at the problem?
I got the KeepassXC ssh agent working on Ubuntu 16.04.6 with Unity as the window manager.
The issue is that if the SSH_AUTH_SOCK environmental variable is not set before the window manager starts it is not available for programs started in the window manager.
Some distributions have a system for starting programs such as the ssh-agent before the window manager. On my distro I found that /etc/X11/Xsession.d/90x11-common_ssh-agent was starting ssh-agent. See this comment on a user help issue for KeepassXC for more information.
However I also found that GNOME Keyring was starting an ssh agent of its own. I had to disable this in the startup applications. I also checked that no shells startup scripts (ie. .bashrc .bash_profile .profile .config/fish/config.fish were trying to start the ssh-agent, as doing so would replace the one started before the window manager.
An interesting side note, the ttys, that you get to with Ctrl+Alt+F1, Ctrl+AltF2, etc., also do not have the SSH_AUTH_SOCK environmental variable set as they start up before the window manager. If you need it here you can add code to find and set the SSH_AUTH_SOCK. For the fish shell I added the following to ~/.config/fish/config.fish:
# Set SSH_AUTH_SOCK if not set.
if test -z "$SSH_AUTH_SOCK";
set -gx SSH_AUTH_SOCK (find /tmp/ -path "/tmp/ssh-*/agent.*" 2>/dev/null)
end
I also found that in the upcoming 2.6.0 release of KeepassXC (targeted for 3. April 2020), there will be an added settings to allow overriding, or settings the value to use for SSH_AUTH_SOCK. However as this changes each time ssh-agent starts you will either need to keep changing it or set-up a link that would point to the current sock.

How can I launch postgres server headless (without terminal) on Windows?

Using Postgres 9.5 and the libpqxx c++ bindings, I want to launch a copy of postgres that is not installed on the users machine, but is instead packaged up in my application directory.
Currently, I am using pg_ctl.exe to start and stop the server, however when we do this, pg_ctl.exe seems to launch postgres.exe in a new terminal window.
I want it to launch postgres.exe in a headless state, but can't work out how.
I have tried enabling/disabling the logging collector, setting the logging method to a csv file (instead of stdout/stderr), and a couple of other logging related things, but I don't think the issue is the logging.
I have also tried running postgres.exe manually (without pg_ctl) and can get that to run headless by spawning it as a background process and redirecting the logs, but I would prefer to use the "pg_ctl start" api for the "wait for startup" (-w), and "timeout" (-t) options that it provides.
I believe you won't be able to do that with pg_ctl.
It is perfectly fine to start PostgreSQL directly through the server executable postgres.exe. Alternatively, you can use pg_ctl register to create a service and start the service.
In my use case, I was able to resolve the issue by running pg_ctl.exe using
CreateProcess, and providing the dwCreationFlags CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW.
I was originally using CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS, but DETACHED_PROCESS still allowed a postgres terminal to appear. This is because DETACHED_PROCESS will spawn the pg_ctl without a console, but any process that inherits stdin/stdout from pg_ctl will try to use it's console, and since there isn't one, one will be spawned. CREATE_NO_WINDOW however will launch the process with a conhost.exe, however the console will have no window. When the executables spawned by pg_ctl try to write to the terminal, they will successfully write to the console created by the conhost.exe which has no window.
I am now able to run pg_ctl from code with no console appearing.

How to remote open playframework app (prod)?

I've done my development of play framework,and I have dist it to be a binary version uploaded to the server.
So,my problem is everytime i open it on ssh , it will shutdown when i logout , how to make it running until i shut it down manually?
You can use screen. It will start a new session that will stay open even if you disconnect from the server. You can then, on the next ssh, reconnect with screen -r -D. There are a ton of useful features such as creating multiple "screens" with ctrl+a and then c (see e.g. screen intro on digitalocean for more) so you can continue working on the server while the app is running
add nohup to your launch command to ensure it is not terminated when you exit your shell.
nohup exec /path/to/my/app/bin/myapp -Dhttp.port=8080

emacs as a screen/tmux alternative - detach from terminal

It's well known that emacs can be used as a terminal emulator (while itself is running in a terminal emulator), thus making it a valid alternative to more traditional terminal-in-a-terminal approaches, such as tmux or screen. However, there's one thing that could be done easily with the latter and I've found no alternative in emacs' term for this one so far.
Both tmux and screen can detach from a terminal and all tasks ran in their windows continue to run in background. It's done using C-b, d in tmux and C-a, d in screen by default. Later, I can return (reattach) to the terminal I've detached from by running something like tmux attach or screen -r. Also, sessions run in both of these terminal multiplexers are persistent - i.e. if I'm connected to some remote terminal and connection fails, I can reconnect and reattach to the terminal without losing any of my work - it really helps in case of faulty network link that occasionally breaks ssh connections.
Is there something like that available for emacs? Basically, I'd want to be able to:
Detach from emacs and leave it running in background with all the sub-processes ran in term buffers intact.
Reattach to it later and find all my processes running.
Automatic detachment of emacs from terminal on receiving a SIGHUP.
Use emacs daemon:
$ emacs --daemon
Then simply launch a new frame, equivalent for screen -x:
$ emacsclient -t

Xcode Debugging process can only be killed by rebooting Mac OS

Sometimes Xcode does not stop the debugging process properly and the only way to kill that process seems to be a reboot of the mac.
I can not kill it via shell command (kill -9, or actually sudo - kill -9). I also tried to remove the process from the launchctl table before killing with the command, which also does not work, the command returns 'No such process'.
Is there really no other way than rebooting the system in such a case??
Thanks.
Try looking here: Couldn't register with the bootstrap Server and here: iPhone - strange error when testing on simulator
I myself experienced this occasionally, but I've never managed to resolve it using any of the methods stated. Hate to say this, but I always end up restarting the Mac to fix it.