State server in ubuntu - mono

I deployed ASP.NET 4.0 website on ubuntu with apache2 and mono.
I want to use session state server for that i have to run asp-state4 command in terminal so that state server will get started.
When i run above command all is working fine but after running command i have to keep that terminal open --
if i close that terminal state server will get stop and website won't work.
Is there any way to keep state server running in background, without keeping terminal open?

For its source code, we can see that it was just designed that way,
https://github.com/mono/xsp/blob/master/tools/asp_state/asp_state.cs
As the source code is freely available, modify it as you wished.

try screen command
screen -dmS aspstate asp-state

Related

Ubuntu Server - Not able to run server in background

I am running server for Rimworld on RapsberyPi 4B.
I have problem with running it in background, when i start the server:
./Open\ World\ Server
Everything starts but name of CMD is the name of the server and when i close the CMD window server will stop.
I´ve tried many things like & after the command, nohup and others. Also I´ve tried pm2 as it is running my discord bot, but everything that I´ve tried is stil saying that Open World Server is "Stopped".
So what i need is:
Run this server in background
Start this server after restart automatically.
Thanks everyone for help :)
So I have found the solution.
I´ve tried pm2 many times but never this way.
nano
#!/bin/bash
Command you want to be executed. In my case
./Open\ World\ Server
Save this like run.sh or whatever.
After that simply do this
pm2 start run.sh
And that is all you need. You can do the same way with minecraft server or other things you want to run in background and start with reboot of your Pi or other devices.

VS code can't ssh to server: failed to create hard link

SETUP
I have a windows 10 PC connecting to my linux server (ubuntu 18.04.2). I run/edit code on my powerful server by remotely accessing the server through VS code's ssh ability. It is super convenient to edit my code on the server with VS code...
THE ISSUE
Visual Studio code won't connect to my Linux server. What is weird is that I am able to ssh into the server from the terminal within VScode by just literally typing ssh <username>#<server-hostname>
However, when I do the Remote-SSH option within VScode then it does not want to connect to the server...strange...
Here is how I remotely SSH into server with VScode built in functionality (marked with red rectangle). Also part of this screenshot is my config file, which I have triple checked as correct (IP address and .ssh/id_rsa_gpu_1_solarpv_ssh location)
HERE IS THE ERROR OUTPUT
MY ATTEMPTS
I have made sure that the config file is setup correctly and that the IP address is correct.
I have ensured that the server's IP address is also in the 'known_hosts' file located at /Users/.ssh/
I even generated my own private key for SSH connection as advised by the great documentation here: https://code.visualstudio.com/docs/remote/troubleshooting#_quick-start-using-ssh-keys
Still getting the error of failed to create hard link...
With all of my back-end stuff done right, I am absolutely clueless regarding why this is an issue.
After spending literally 9 hours on this issue...here is the answer:
When you launch VScode and remotely access the linux server, the linux server is instructed to download and install a vscode server so that you (on the other side) can remotely connect to the server.
If the server does not have internet just make sure the following setting is ticked
This allows the remote server (without or with internet connection) to get the vscode server running.
To eliminate the "failed to create hard link error" go to the directory mentioned by the error, which in this case on linux server is
navigate to /home/<username>/.vscode-server/bin/0ba0ca.../
then remove/delete the hardlink file and target file which also has
the same name as the directory.
Then just attempt to remotely access your server again through
vscode and all should be fine
Here is also a discussion regarding the issue...if you still have problems https://github.com/microsoft/vscode-remote-release/issues/2507
I solved this by enabling the option Lockfiles in Tmp:
i just deleted the whole library and it works, i don't see anything wrong with doing that.
rm -r /path_to_project/.vscode-server/
if i'm wrong feel free to correct me :)
Try this
Just in case others need to try the same here is the detail
ctrl-shift-p and choose:
Remote-SSH: kill VS Code Server on Host...
Chose the host name
Selected the platform type (linux)
https://github.com/microsoft/vscode-remote-release/issues/4307#issuecomment-762882247
worked for me.

Windows could not start the Apache CouchDB service on Local Computer

I have installed CouchDB on my Windows machine but while starting the CouchDB service, I am getting a message like:
Windows could not start the Apache CouchDB service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error. If the problem persists, please contact your system administrator.
As the service is not running, I am unable to access Fauxton too.
I am using Windows 7. CouchDB is 2.0.0. Port 5984 is not in use.
I don't think your question is a duplicate of https://stackoverflow.com/a/44107335/219187 because you are on Windows 7, and the problem described there is for Windows 10 with the creators update.
But maybe the solution fixes your problem as well? Here is the procedure:
Download the prelease build 2.2.4-101 from https://nssm.cc/download
Stop the CouchDB service through the Windows Services dialog (paused is not enough)
Overwrite nssm.exe in <CouchDbInstallDir>\bin with the one from the downloaded ZIP file (make sure you pick the right version 32 bit / 64 bit)
Start the CouchDB service
Issue it's happening since the last updates released by Microsoft. I'm not completely aware of what's causing it, but I think it's something related to CouchDB service not been able to start using Local Administrator rights.
However I've managed to start the service manually, by doing so:
Open Command Prompt - in the Search from the Start Menu or Task Bar type "cmd"
Run it as an Administrator - right click on the Command Prompt application and choose "Run as administrator" option /this is really IMPORTANT as it will allow the service to have administrator access/
Navigate to the folder where CouchDB is install - default path is "D:/CouchDB", but could be anywhere else; you have to find it
Go to the "bin" folder in there
Type "couchdb" as a command to start the service
You will see a message showing after this - "kernel-poll not supported; "K" parameter ignored"
If it adds some error messages after it or closes the whole terminal, you're making some things bad from this guide, so follow it strictly.
You can now open up the Fauxton application in the browser like normal from here - http://localhost:5984/_utils/
Keep in mind that you have to leave the cmd opened in order the service to be working as expected. As far as I saw no information was lost, so it's all good.
This is a temporary solution though, as we are waiting a relase from either Microsoft or Apache to solve the issue, or at least give us more explanation about it.
i just met the same problem.
the cause is space, you have to install CouchDB in a path without any space, even Program Files folder, because there is a space between Program and Files...

Vagrant starts but cannot connect until I do a 'force provision'

I've got a Windows 7 machine setup with vagrant/virtualBox - each morning when I try to access my development site it always a 'Unable to connect' error message in my Firefox browser.
Even though I have booted the machine using the 'vagrant up' command for some reason it only seems to be accessible via the browser once I have done the 'vagrant provision' command. This is obviously annoying as it starts doing stuff from scratch.. eg installing my mysql database again.
Can anyone provide any light into this, and why it seems to fail to connect all the time - as this provision command is only a temporary fix as i'll need to amend the DB everytime which is only feasible in the short term.
Might just be my own setup - but I noticed nginx was restarting so have to restart this each time

Tornado stopped running on AWS immediately after I terminate my remote session

I'm using SSH to remotely launch Tornado on Amazon Web Service. It works fine when I launch it by:
python startTornado.py
However, after my SSH session times out or terminated, the Tornado server is also stopped immediately, so I can't access the webpage anymore. I did quite some search but couldn't find an answer on Google.
How can I keep Tornado and the site running after my SSH session terminated?
The process will shut down when you logout if it's running in the foreground or if it tries to write to stdout and the terminal it's outputting to no longer exists. Try starting the server with
nohup python startTornado.py &
The nohup command redirects output to a file, and the & at the end runs the command in the background. Alternatively, you can use the screen utility which allows you to detach a terminal and reattach it in a different ssh session (see the screen man page for details).
While all the above solutions solve the immediate problem, what you might really need to run such processes in production, control them (start/restart/stop) is supervisor. It is python based and its more useful when you have to run multiple instances of tornado behind nginx.
In addition to nohup as Kevin has mentioned, you can also use disown command if you are using bash:
disown <job-id>