I am running a python script on say machine A. Is there any way to know if the python script is running or not from another machine B from command line? I tried getting the process list from the task manager. But it does not show any information regarding this script though it is running( it only showed cmd through which the script is executing ).
This will be a three step process. Step 1 is only required because you are Windows. If you're Mac or Linux, they already come with Step 1 completed for you. Otherwise, this is completely cross-platform capable.
1) You need to remotely connect from Machine A to Machine B. One extremely popular way of doing this is SSH, which can be installed on Machine A and Machine B. The recommended way to do this is with FreeSSHd, which has been very well documented here: https://serverfault.com/questions/8411/what-is-a-good-ssh-server-to-use-on-windows
2) Install the paramiko SSH library for Python. This will allow you to connect to another machine, and execute any arbitrary command line command. On windows, you just need to install the binaries for paramiko and pycrypto/openssl. This also is well documented on SO here: installing paramiko on Windows
3) Decide how you want to harvest the process list. There are several ways which are well documented here: https://stackoverflow.com/questions/53489/how-do-you-list-all-processes-on-the-command-line-in-windows
Related
I'm so sorry because I know this is a dumb question, but I've been trying to figure this out for about 2 hours and I can't figure it out. I've created a bash file that uses some other programs (tcpdump, tshark). The bash runs as it should but on every line that I use tshark, tcpdump, etc. it says "command not found".
I'm using Cygwin on my Windows 7 VM. All of the files are in the same folder and I I've tried adding the locations of the other programs to the PATH variable. I tried commands such as export PATH=$PATH:filelocation but when I do $PATH those results aren't showing. How can I get these commands to be recognized?
Thank you.
current errors
Cygwin is not a Linux distro, therefore, you don't have all the functionality like you would if you had a Linux installation.
You could try one of the following.
1) Use Virtualbox to make a VM of some Linux distro and use bash there. You could use Ubuntu server, which has no GUI.
2) Use this site to find packages that will add functionality to Cygwin.
3)Upgrade to Windows 10 and have a native (sort of) bash to use.
I am in the process of installing jupyterhub. I successfully install jupyterhub using:
python3 -m pip install jupyterhub
npm install -g configurable-http-proxy
However, when I run jupyterhub -h in the Windows command prompt it gives:
"jupyterhub" is not recognized as an internal or external command, operable
program or batch file.
I added C:\Users\User\AppData\Local\Continuum\Anaconda3\Lib\site-packages\jupyterhub\ to my user environment variable, however still receive the message. What path should I be using?
Please note that according to this, Jupyterhub is not officially supported for Windows yet.
That aside, you could dockerize it to make your life easier. For this error, please check if you can see the executable in C:\Program Files\Continuum Analytics\Anaconda3\scripts. The lib directory you're specifying contains python source files and not the executables.
I had this same issue, and I saw this occurred because jupyterhub is a python script rather than an executable. So to run this on Windows I needed to execute it like python C:\Program Files\Continuum Analytics\Anaconda3\scripts\jupyterhub.
However, I still was unable to run jupyterhub on Windows because it depends on the pwd module, which is a Unix/Linux only module.
As others have said, Windows is not a supported platform. JupyterHub is best used on Linux-like platforms where you have Docker or something similar to conatainerize each user's session.
A good alternative is to install Oracle VirtualBox and run a local VM. I run a 64-bit Ubuntu and it's quite good performance. It makes things much easier to run JupyterHub on. Asides depending on pwd, there are also assumptions around user-creation and other activities that Windows isn't going to handle well.
In short, if you want to run on native Windows, you're going to become the first JupyterHub Windows contributor. I looked at doing it but it looked like too much effort.
The upside of running a VM is that behaviour in the VM is going to more closely resemble what you have running on the server anyway. If you don't plan running on a server, then just "jupyter notebook", as this is all JupyterHub ends up running...
I feel like there is something fundamental I'm missing here, and because of that googling the error has been very difficult.
I've set up an SSH connection to my home computer using the instructions I found here:
https://winscp.net/eng/docs/guide_windows_openssh_server
I'm able to access ipython interactively by entering ipython but the prompt is not behaving at all like I expect. Please see the following interaction:
The session isn't immediately responsive and seems to be running the commands in some type of batch mode, and still not all of them. I don't receive any output until I exit the program. Running python and not ipython behaves similarly. I'm hoping to have a somewhat more standard interactive python experience, and have no idea how to go about debugging this.
Information on my system:
OS - Windows 10, both machines
SSH - OpenSSH set up through link above
Python - 2.7.11, Anaconda install 2.5.0
Remote access application - Putty
Thanks for any help-
I am connected to a Linux server from my Windows machine using putty. I need to create a ruby file and execute the same. Should I create the Ruby file on my machine or on Linux server? Please advise.
Best workflow in this case would be to write the rb script in whatever environment you want ... many people like developing locally on their own machine (which has advantages), and many prefer developing it remotely on another machine.
Basically write it the same way as you would write any ruby file on your favorite text editor using your favorite method.
Then you upload the rile to the remote machine -- you can use software like WinSCP and then run the script using ssh:
$ ssh (server address)
$ ruby (path to wherever you put the script)
It doesn't matter where you compose the script.
You can either compose it locally or remotely
When you're composing it localy you can do it with your well known GUI-Editor Tools like Notepad or so, but you'll have to upload the file to the server to use it there.
When you're composing it remotely you'll have to use CLI-Editors like nano or ViM for it, but you're able to run it instantly without uploading it
And you can run the script on the remote machine as usual
$ ruby path/to/you/script.rb
assuming ruby is already installed
If you want to execute the ruby file on server you have to create it on the server.
Is it possible to run a windows xp bat script remotely from a ubuntu machine via command line?
This is possible if you have an ssh server running on the WinXP machine. It is trivial to set up such a server if you have installed Cygwin. This is well described here.
Then from an Ubuntu command line (or cron job) you run
ssh user#winxp command
Make sure your .bat has executable permissions.
I think that the technology you are after is WMI. I see that there is an ubuntu package called wmi-client, which you can sudo apt-get install and attempt to you. Some quick searches and I'm unable to find details, but maybe that will get you somewhere....
You would probably use something like remote desktop, and if you did it that way, it would work, but your question isn't very specific