How can I run xsp4 as a background process on linux? - mono

Is there an easy way to get xsp4 running as a background process on a linux server?
When I run xsp4 I get this:
xsp4
Listening on address: 0.0.0.0
Root directory: /test
Listening on port: 80 (non-secure)
Hit Return to stop the server.
So if I quit the terminal I am running it from it stops the server.
Do I have to write a daemon to do this? Or is there already something in place that I am missing?
Thanks

You have a couple of options. If your problem is terminal closing, then screen can be simple solution (just run screen xsp4, then Ctrl+A,D and you can close terminal). If the method you have used suits you, then use it -- however xsp will die after terminal closing. xsp should be generally used for debugging, production solutions are FastCGI or apache module, so these are daemons "by definition".

I had to use Mono for a demo that I had to show, and faced the same problem. My workaround was:
xsp4 --nonstop &
Note: It will show the initial information and if you hit enter, it will continue running. You can also exit the terminal if you want and it will continue as well.

you can do install the xsp4 in the terminal
sudo apt-get install mono-xsp4
then
go to your project Folder where the Asp project saved and type in the terminal
xsp4

Related

(WSL error at Startup) Press any key to continue

Problem:
When I launched Ubuntu 20.04, it pops up: "Press any key to continue...", and then if I press any key, it exits immediately. This prevents me from using (typing any command) in Ubuntu WSL. (It occurred suddenly today. For the last couple of days it has been working properly.)
Screenshot: Press any key to continue pops up after startup
Attempts Tried:
LxssManager service is running. But LxssManagerUser and LxssManagerUser_60d78 are stopped. Manually starting the two services doesn't help as they automatically stop themselves right afterwards.
Hyper-V service is set to auto. Virtualization mode is enabled (task manager -> performance -> CPU)
Trying to re-run the update from here https://learn.microsoft.com/en-us/windows/wsl/wsl2-kernel, but it shows WSL not installed (which is weird since I have been using it for a long time before)
Environment:
OS: Microsoft Windows 10 Family, Insider Preview
Version: 10.0.20152 Version 20152
System Type: x64 based
I'd accidentally mounted the WSL virtual disk image by double-clicking it in explorer, and it remained mounted to my machine even though it reported an error that made having it mounted useless. Unmounting the vdisk from Disk Management resolved the issue for me.
From https://github.com/microsoft/WSL/issues/4177#issuecomment-597736482
There is a conflict between wsl.exe and Proxifier.
Developers of Proxifier gave a solution.
Thanks for the info.
We have reproduced this issue. Apparently, wsl.exe displays this error
if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call
for wsl.exe to prevent this. Under the hood the call creates an entry
for wsl.exe at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.
We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the
parameter: NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.
And it works well for me!
This worked magic! Go to the Windows Command Prompt and run the following command:
netsh winsock reset
Then Restart your computer. NB: Don't Shutdown since it did not work for me. Instead, Restart!
More answers can be found here.
I solved by downloading the https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msimsi and excuting it.
see https://learn.microsoft.com/en-us/windows/wsl/wsl2-kernel
I went into the bios and had to enable virtualization from there
if you got this error:
An operation was attempted on something that is not a socket.
there is something wrong with windows sockets and try this command in cmd administrator mode to reset windows sockets.
1. netsh winsock reset catalog
2. netsh int ipv4 reset reset.log
3. netsh int ipv6 reset reset.log
4. Restart the computer.
Maybe not relevant for TO but I had the same issue and just had to run in Windows Terminal:
wsl --shutdown
After that Ubuntu worked again.
powershell => type "wsl --shutdown" => error message
ctrl-alt-del => services => HvHost => right button => restart (think to stop all hyperv virtual machines before ?)
powershell => type "wsl" => OK
restart hyperv virtual machines

x2go issue with XFCE and Ubuntu 20.04

When I connect x2go with XFCE Ubuntu 20.04 (KVM VM) after ~10 minutes of idle time, x2go will lose its mouse focus and keyboard focus and there is no way to grab control of the session. Even restarting x2go will not bring the focus back.
The XFCE VM is still running because I can see the top output in the console.
I tried several key combinations to bring the focus back but it does not. I tried LXDE and it does not have this issue. I tried XFCE desktop 20.04 on its running in a KVM VM. I also tried installing Ubuntu server 20.04 and load Xubuntu-desktop (KVM VM) - the same issue. After ~10 minutes the x2go session-focus is lost.
What brings the session focus back is if I reboot the VM and then connect to the VM again using x2go. as I mentioned just restarting x2go will not bring the session focus back.
I tried uninstalling the screensaver and the power management features in XFCE but that did not fix this issue.
Update: this x2go bug report log suggests its screensaver related. Using the applications/settings/screensaver allowed me to turn off anything related to the screensaver, solving the problem for me. Issue appears to be solved here similarly: askubuntu forum
I've been having the same issue w/ XFCE and LXDE both after an idle period (10-15 minutes), and only on Ubuntu 20.04, not on 18.04 or earlier. In either desktop env, the session was not recoverable and required termination of the session either from the client side or via a separate terminal ssh session to kill <PID> the x2gocleansessio process on the server side (after seeing it was running using top). For a short period, I regained control in the new session until the cycle recurred.
Seems like a major problem for x2go in Ubuntu 20.04.
Just to save everyone the time of digging through the AskUbuntu forum... run this + restart and you should be good to go on Ubuntu 20.04 -
sudo apt-get remove xfce4-screensaver
If your are login via x2go and don't want to uninstall xfce4-screensaver, it's hard to solve the problem because there are intern script of xfce who launch xfce4-screensaver whatever you told him to do. I found my own workaround WITHOUT root privilege:
First activate screensaver on start-up :settings-manager -> Session and Startup->check screensaver(that sound weird but by this way you are sure to launch your xfce4-screensaver localy otherwise it's the root user who launch it which this own startup file which you can't edit without root)
Second : in ~/.config/autostart/xfce4-screensaver.desktop (if it doesn't exist uncheck then check screensaver in first step). Add to the end of this file:
Exec=sh -c "kill $(pgrep -u <YOUR-USERNAME> screen)"
This will launch it but auto-kill it after OnLogin
Edit: it's better than uninstall it because in my case that was the administrator that install for every user xfce4-screensaver so I can't uninstall it because the computer need a screensaver on the real sessions (I mean not in ssh on the physique machine). Maybe switch to Xscreensaver or other screensaver will solve this problem

Fedora how to automatically run the ssh daemon

I would like to know what are the ways to automatically start daemons (sshd) in Fedora system. I know I can write a startup script that will put on /etc/init.d/.
What are the other options?
Somewhere I read that now in the new version of this can be done using the commands in the terminal, but I do not remember what it was.
EDIT: My 2 question.
I install ssh from source. When keys are generated for a server? During the installation?
You can do this via systemctl:
systemctl enable sshd.service

Apache Web Development on Cygwin

I'm trying to get an Apache server running on my Cygwin setup to follow the Java Ranch Cattle Drive tutorials online (basically, to learn Java EE web page development that uses a MySQL back end.)
I used the Cygwin Setup program to install httpd (which is how I installed most other dev tools I use on cygwin) and it says install complete, yet when I run 'httpd' it cannot find the command. It also appears the expected install directory (/usr/local/apache...) doesn't exist.
Does anyone have any experience using this setup, and if so, you could walk me through the initial steps of getting the server up and running and getting a browser to display the server's default page?
To keep answers focused, I didn't want to discus the drawbacks of running Apache on a Windows system - this is just for learning purposes. Thanks in advance.
Looking at the Cygwin Package Listing for httpd, you can see that the executable is installed under /usr/sbin.
So, if /usr/sbin is not on your PATH (it isn't on mine, not by default anyhow), you would actually run:
/usr/sbin/httpd
And btw, if you would like to list the files installed for a certain package, you can use cygcheck:
cygcheck -l httpd
cygrunsrv -I Apache -p /usr/sbin/httpd -a "-X"
This will solve the problem. This assumes you already have cyrunsrv set up. The reason httpd fails with cygrunsrv if you leave out the -X is that the process disconnects from the terminal and cygrunsrv considers that a failure. The -X option for httpd is the debug or terminal mode.
I couldn't find any detailed information on how to get Apache working on Cygwin, so here it is if someone's interested:
Install the httpd-* and httpd-mod_* packages you need. Note that the packages named "Apache" are deprecated. You need the ones named "httpd" (which are actually Apache).
Install cygrunsrv (normally this is a default Cygwin package)
Run /usr/bin/cygserver-config as admin. This is needed because Apache requires an IPC server running.
Open services.msc, then go to the CYGWIN Cygserver. Right-click on it and start it. If you don't do this, you'll probably get errors like "AH00023: Couldn't create the proxy mutex".
Finally, start Apache by running /usr/sbin/apachectl restart
Config is in /etc/httpd/.
Some information about running Apache on Cygwin:
http://httpd.apache.org/docs/1.3/cygwin.html
http://www.issociate.de/board/goto/895433/apache2_does_not_start_in_cygwin.html
http://www.cygwin.com/ml/cygwin-apps/2005-02/msg00085.html
Personally, I would recommend installing WAMPServer or other WAMP stack and do it that way. There is no difference, except that you'll need to control Apache through Windows commands [net start, net stop], not Cygwin's ones.

IntelliJ - Running Program as Sudo

Developing a program on OSX using Java and IntelliJ. Deals with network sockets and ICMP. Hence, the program needs to be run as root or sudo'd on OSX. Program runs fine from a terminal window outside IntelliJ under sudo. However, I would like to debug and run it from IntelliJ (V9). In IntelliJ it errors (I need root privs to enumerate network devices). I know how to pass program and VM parameters in IntelliJ but now how to hit Run and/Debug and have it run under sudo? What is needed is basically sudo java ...... MyProgram instead of java ..... MyProgram Any ideas or workarounds.
I came out with an answer and wanted to share it just in case anyone else runs into this. To solve the problem, I took my cue from what I do with QT & QT Creator when doing network programming.
On OSX, I opened up a terminal window and cd'd down to/Applications/IntelliJ IDEA 9.0.3.app/Contents/MacOS. There you will find a file called idea which launches the IDE. I ran that as sudo (sudo ./idea). That took care of permissions on anything Intellij launched and I could debug and step through my code as needed.
sudo /Applications/IntelliJ IDEA 9.0.3.app/Contents/MacOS/idea
Since this is a dev machine and I am in control of it security is not an issue in this case.
Hope it helps someone else out.
Inside a terminal:
sudo -s
give access to the root user.
from there you could run the Idea IDE using the script:
/Applications/IntelliJ\ IDEA*/bin/idea.sh
and in this way I'm able to work on network where permission errors where printed before.
Debugging of sudo programs is disallowed by the operating system unless the debugger is running as root, for security reasons.
So, even if you can figure out how to get IntelliJ to use sudo it won't do you any good.
I know this is not what OP directly asked -
In case someone needs to do this on Linux (Ubuntu), e.g. in order to update Idea, just run from command line:
sudo /usr/local/bin/idea
Only make sure once the Update and Restart is finished to actually close Idea and start it normally
I agree with #Darron, it is not recommended to execute IntelliJ with sudo.
You can execute with IntelliJ terminal instead.
I maintain my project in IntelliJ. When I need to execute a unit test that requires sudo access, I just open IntelliJ terminal and type:
sudo gradle test
Good luck!