Working 'gnu-screen' alternative for Minecraft Servers on WSL - ubuntu-18.04

I want to launch my minecraft server on SSH on WSL (Ubuntu 18.04) on Windows.
The way I plan to do it with a phone or something: Connect to vpn, then ssh into windows, then type wsl (works fine), and finally open a session (for example screen) and launch the script for the minecraft server in there.
The problem is, when I finally get into launching the script and detaching the screen and close the ssh connection, the screen will close after some time automatically.
WSL says it was terminated. I dont know what to do.
I should also add that the script should run permanently.
The mc server is running on java and constantly gives output. So I want it to be available all the time.

linuxgsm.com is a Server manager that is also available for minecraft, it uses tmux and is a perfect alternative with many other features.

Related

start batchscript on remote host over ssh

i have this setup:
1 Host with Windows 10 and Cygwin Unix Tools (for a unix filesystem and the open-ssh server).
2 On the Other side there is another Linux Gentoo client.
Is there any chance to execute batch file on the host?
Like this 'ssh name#host start data.bat'?
U guys would help me a lot <3
If we you want to run command/script on the Windows 10 host, you need a SSH server set up on Windows. Although there are some rumors that Windows Powershell will have built-in SSH server support, I did not aware that it is released yet.
That being said, you have any third party tools to set it up . For example, check here.

Is it possible to inventory MSSQL-Linux running within Docker?

Part of my job involves data collection to help size workloads that could be transferred to the cloud. An element of this is being able to enumerate SQL instances within a client's environment for insights such as "hey you have some out of support legacy SQL here that was supposed to be decommed years ago, what's the deal."
With the release of SQL Server 2017, I've just now created an instance of the SQL Server Enterprise 2017 on Linux container (using this image) that I'm running locally on Windows 10. I can connect to the instance via SSMS and SELECT ##VERSION to confirm it's legit, but my question is if it is possible to inventory the device and find the SQL instance without knowing that connection string.
Things I've tried:
-Running on Windows 10 so I believe this is supported via Hyper-V, when I try to go through the Hyper-V manager to connect to the VM Docker spun up, can't get any interface there (which I figured, since Docker emulates apps rather than full VMs)
-Tried to do a sqlcmd -L from the Win10 host device and don't see the instance (Don't have SQL installed on the Windows 10 device I'm running this from)
-I can find the docker image via a docker ps, then exec -it to bash, and use sqlcmd from there, but the sqlcmd -L isn't listed as an option within Linux.
-ipconfig from the host device shows the Docker IP address, but it wouldn't give me the port information so I would have to scan through all the ports which feels dirty.
I'm kind of at a loss at this point. If I didn't explicitly know a Docker container was running MSSQL-Linux, is there any way I could identify that from inventorying the host device? (sorry for the long post)
After banging my head on it for a bit I've found a painful workaround of:
connect to the container's bash using: docker exec -it <container_name> "bash"
then using ps aux | grep sql to list all of the sql processes. The MS image shows up as /opt/mssql/bin/sqlservr from local testing. Once SQL has been identified you can attempt to connect to it using the Docker ip from ipconfig and the port from docker ps
It's not elegant, but it should be possible to automate those steps for use across a set of unknown devices.
Leaving this open for a bit for any better alternatives.

Powershell remoting executing SQL Server installation msi fails

I am trying to use Powershell remoting invoking "chef local mode" on a remote virtual machine.
I am using Powershell code like: invoke-command -session $session -ScriptBlock{}
The code invoking chef recipe works fine on the remote VM remote desktop Powershell window.
But it always fails entering "invoking msi" step of that recipe.(I am using official chef SQL Server recipe by the way).
Error log doesn't show anything, but it looks exactly like me manually force closing popup dos windows of SQL Server installation Application while installing locally on the remote VM.
Is there a restriction on Powershell remoting about new window spawn or something?
I had similar problem invoking MSI directly using Powershell scripts, which I had to work around with schedule a Windows task first and kick off it immediately.
PowerShell remoting is subject to severe constraints, see Quota Management for Remote Shells, most importantly MaxMemoryPerShellMB which is 1GB default. Even if the unnattended SQL instalation is correct, the MSI will likely run out of memory due to this constraint. The default values can be modified, see Learn How to Configure PowerShell Memory.
But is very likely that you're running incorrectly the unattended installation. Remote sessions are not allowed to interact with the Desktop, so no, they cannot spawn windows. Read Install SQL Server 2014 from the Command Prompt and Install SQL Server 2014 Using a Configuration File. Only after you validated locally that the unattended installation is correct, attempt to run it remotely.
I don't know what the 'official SQL Server' recipe does, but I wouldn't trust any such. I would make sure I run a correct unattended installation and build my own recipe from that.
As I mentioned in the comments, I am still hitting same problem after applying Hotfix from Microsoft. And again, I picked up workaround using schedule job to execute installer. This is acceptable approach in Vagrant Core 1.6
The most difficult part of the plugin was the elevated runner which takes any commands and runs them through a scheduled task instead of directly through the current WinRM shell. This whole rigamarole is needed because of the Windows permission model. You may be running your WinRM shell as Administrator, but its not the same as running Administrator locally on the box. This leads to all kinds of unexpected errors for users trying to install software on a Windows guest.
via here
and implementation code from Vagrant is here

Executing batch file on Windows 2008 server from CentOS Jenkins instance

I have a Jenkins instance running on CentOS and would like the ability to connect to a Windows 2008 virtual server and have execute and write permissions.
Some threads have suggesting CYGWIN, installing on the windows machine and then using SSH to connect. There are also suggestions of telnet and RDP. I wanted to know if there is a recommended approach.
Thanks
You can connect a windows slave node into your main server
https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines
as mentioned earlier in a comment
I have to make Delphi builds on windows with my main jenkins installation is on a CentOS server.
You just need to configure the windows machine as jenkins slave. Java web start is a quick and easy solution (2 minutes) for that:
https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds#Distributedbuilds-LaunchslaveagentviaJavaWebStart
Or step-by-step here: https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines
Then on "Project setup" check the "Restrict where this project can be run" and write down the slave name. (There will be time later for more complicated expressions)
Finally istruct your project to exec windows commands adding one of those plugins
https:// wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin
https:// wiki.jenkins-ci.org/display/JENKINS/Windows+Exe+Runner+Plugin
(sorry for the broken links but it doesn't let me post more than two)
If it's just a few times use netcat.
Otherwise use cygwin and ssh like you said.

stoping and starting IIS 6.0 or my application pool on IIS using a batch file

I have two windows boxes. one is windows xp(local computer) where i need to write a batch file and the other is windows server 2003 where my IIS is located. Now i need to write a batch file in windows Xp that needs to do these below mentioned operations in it.
Stop the IIS or my application pool on that IIS.
Start the IIS or my application pool on that IIS.
These stop and start need to be performed in two different lines. The windows Server 2003 box has a different user id and password to my windows xp(local computer). As i am new to writing the batch files, after my one day of struggle i am just able to kill the process of my application pool(w3wp.exe) on IIS which is located in the windows server 2003 and i am still not sure what i have written is correct or not. Please help me how to stop and start the IIS which is on server 2003 box, as the batch file should be on the xp box. Thanks in advance for your help.
There is a built-in program for starting/stopping/restarting IIS - iisreset.exe
Calling this program on its own will stop and then restart IIS. If you want to just stop IIS without starting it again, use the following:
iisreset.exe /STOP
And then later you can start it again like this:
iisreset.exe /START
This should work for all versions of IIS, regardless of the operating system version. Just remember that you need to execute it as an administrator.
EDIT: Just noticed that you want to run the command from your XP box to restart IIS on a W2K3 box - there is an optional parameter to specify the target computer:
iisreset.exe ServerNameOrIp /STOP
And:
iisreset.exe ServerNameOrIp /START
finally after a long struggle i made it work by "starting and stopping the iis from remote box with different id and password". I have initially tried runas command which didn't work and then i moved on to ps tools and used this below mentioned commands.
psexec \COMPUTER_NAME -u USERID -p PASSWORD iisreset.exe /START ----> for starting the iis
psexec \COMPUTER_NAME -u USERID -p PASSWORD iisreset.exe /STOP ----> for stoping the iis
#djhayman --- Thanks for your help man.

Resources