start batchscript on remote host over ssh - batch-file

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.

Related

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

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.

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.

Desktop application needs server side debugging

I am working on client server windows desktop application. The client is in VC++ and server is written in c. When the client sends the commands to server through tcp/ip, the server does some processing and returns some string.
I want to if there are any tools which can help me in debugging at the server side(unix platform), when I run the client on windows.
Is there a way I can use GDB debugger?
Thanks in advance.
RK
The easiest way would be to get ssh access to the server and attach gdb to the process. It would also help if the process was compiled with debug flags.

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