I want to send a magnet using transmission-remote in window - python

You could start downloading remotely from linux to
http://localhost:9091/transmission/web/
using the command in
transmission-remote 9091-nid:password -a {magnet}.
I want to do this on Windows as well.
I used Python and now installed transmission and daemon for window and confirmed that it works on the web.
But I don't know how to send a magnet.

Related

Mac ssh to Windows PowerShell. Trying to get it to open an app (on the PC). Nothing works, including commands that do it entered directly on the PC

Trying to have a python script open an app and then continue on. I have the following setup:
Windows PowerShell (PS) running on PC.
Mac Terminal running bash. ssh... into the PC.
In both windows I get the same "Windows PowerShell, Copyright (C) Microsoft..." etc. info and the same PS C:\... prompt. So it seems I'm in the right place.
Tried various things. In all cases, anything I do directly on the PC that successfully opens the app, when done at the same prompt in the ssh session on the Mac, gives all the same feedback, but doesn't actually open the app.
Things I've tried:
py .\open_mt5.py at the PS prompt, where that script is:
import subprocess
result = subprocess.Popen(['C:\\Program Files\\MetaTrader 5\\terminal64.exe'])
print(result)
py to start python REPL, then enter the above lines one by one. Notably, in both setups, the python REPL prompt becomes available immediately (as expected) and the output is the same, but again, the app doesn't open on the PC.
Just execute the app from the PS prompt: C:\'Program Files'\'MetaTrader 5'\terminal64.exe
...and a few other things.
I think this should work, but it doesn't. What am I missing?
Or, speaking to the end goal specifically: how can I have my python script, run via ssh, open that app on the PC (and of course not have that block the script from continuing)?
Thanks!
Couple of other details if it helps:
It seems the hiccup is somewhere in the ssh, since that's the difference in all cases. But it also seems to be a Windows thing, because if I ssh into another Mac and enter commands to open Mac apps, they open on the remote Mac, (as expected).
Everything else I've ever tried via ssh from the Mac (to a Mac or a PC) works the same as it does typing directly into the same prompt on the remote machine, including running an entire python based REST API server on the PC. So I'm pretty sure everything is configured more or less right.
The app in question needs to be running for my REST API to work as it includes a service that provides some of the functionality. My end goal is have the python script open the app at the start of everything it's doing to set up and run the REST API server, and do so without blocking the rest of the script of course.
New to python. Self-teaching. Desire to learn it (basics at least). New to Windows command line (cmd, PowerShell). Self-teaching. No desire to learn any more than required for specific project. (Mac/unix user normally). Hoping people can reply at that level. 😊
Mac: macOS Monterey 12.4. PC: Windows 10 Home 21H2, python 3.10.5, and the default Win 10 OpenSSH Server.

Sending commands to CMD/MobaXterm via python

I'm making an app via python with GUI.
I want to set a button that will connect to a specific path and run some commands at the server and leave the terminal open after he will finished running the commands.
I'm trying to send a several commands to CMD/MobaXterm with python,
I need to access a certain path with ssh, and add a command, like ls -l
Thanks.

How to always run specific python script on windows server manager 2016

i am new to the community and new in using servers and could use some help.
I am trying to setup an automatic JSON parser to another server using http post calls. The idea is as follows:
I manually put JSON files into a folder Input on the server
A python script that is always running on the server reads the files located within the folder
It reads the JSON files, posts all objects to another server, and moves the files to a "Processed" folder one file at a time.
I have been given a Windows Server, with Windows Server Manager 2016, and have managed to do the following:
installed python 3.8.2. on the windows server
able to run a python script using powershell
Installed NSSM to create a windows service
Now the windows server manager says i cannot resume or start the service that i tried to install via NSSM.
I am very new to servers, as well as python itself. Can somebody help me to get a python script running 24/7 on a windows server with windows server manager 2016?
Edit:
I managed to create a python script that can read files, upload them and move them to a processed folder, but i still have to run it by myself while i want it to always run on the server

Minecraft Server Executing Scripts

I am working on a minecraft world space that can interact with a terminal shell and run commands on the computer directly. I intend to use not just the vanilla server but maybe craftbukkit or spigot.
Is it possible to create a listener on minecraft server.jar and wait for a certain command which executes a script on the computer itself?
Is there a plugin out there made for this purpose?
You can create a new plugin for Bukkit/Spigot (more information here).
In the onCommand-Method you can then call Runtime.getRuntime().exec("your shell command") to run commands in the linux shell (can also be used on Windows servers).
See also the Java documentation.

Python Server in AWS

I have written some Web services in Python.I want to deploy it in AWS, I have created the instance.
I tried to run using putty and it was coming up well using the command python Flo.py, which starts the server 0.0.0.0:8080. But the problem is when I close the putty window the server is terminating. How i can start a server in 8080 just like httpd?
All helps are invited
I highly recommend you use screen (or tmux). And you may want to use upstart as well.
Screen:
Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).
tmux and screen are doing the same thing - which is terminal multiplexing. This will give you a terminal you can attach to and disconnect from to keep it running when you're not on the server.
To test it simply install using:
sudo apt-get install screen
Now use the following to open a screen terminal under the name my_screen, running your script as it starts:
screen -dmS my_screen python Flo.py
And attach to it using:
screen -r my_screen
Detach using ctrl+A followed by ctrl+D, and now you can leave the server (screen will keep running with the process in it)
Read more here.
Upstart:
Upstart is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running.
Upstart is the new way to start services on debian as soon as the system starts.
To add an upstart service you need to add a configuration file under /etc/init (open one of the files there and see an example).
These files can be extremely simple so don't be intimidated by what you see there.
You can make a service to run your server / service and send output to a log file which you can then use to keep track of what's happening.
Read more here.

Categories