Run command in background with Fabric [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to run a background script with Fabric using Bash's '&' operator. Is there a reason the following doesn't work? I executed this command on the server itself and it runs fine.
#task
def run_script():
sudo('sh /home/ubuntu/wlmngcntl.sh start &', user='myuser')
I don't want to use something heavy like Celery to do this simple thing. I don't need to capture the output at all, all I want is for the task to execute this and return after.

This isn't a Fabric thing, but a Linux thing. When you close a session, the processes connected to that session are terminated.
This question has a lot of info... https://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session
You could use the following (from that answer)
sudo('nohup sh /home/ubuntu/wlmngcntl.sh start &', user='myuser')

Related

How do I prevent users's shutdown in WINDOWS? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
I want to design a program that can stop the user from shutting down.
At first I tried to create an unsaved text document, but the user still had the option to force a shutdown. I also know that the shutdown -a commands can prevent a shutdown, so I wrote the following simple python program:
from os import system
while True:
system('shutdown -a')
But when it is running, the system can still shut down successfully, why is this? I hope this shutdown restriction can be turned on or off at any time.It would be nice if you could do this in python,thank you!

Pause event till next day and continue with the rest of the python code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to automate some processes on my laptop...like checking mail, messaging, sending birthday wishes etc
The code is pretty simple for all of them but what i want now is that, for instance, after the function for checking email has being executed, the function should deactivate till the next day...
And the same should happen to the other functions.
All those functions are in the same file and executed in order
So it's more like :
wish_birthday_func()
wish_birthday_func.pause_next_day#even if i #run the file again during the #same day
check_mail_func() #.....
you wouldn't like a permanently running task because you could reboout your latop right ?
So you should look for some sheduler of your os (Windows at, Linux cron etc.)

Executing shell/ssh commands via web app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to run commands on my home server via a web app. Is there a way to do this?
I have no interest in returning the output, I just want to execute commands like irsend when a button is pressed on the page.
You can't execute commands directly from the browser, that is why child_process.exec() does not work when browserify your code.
You will need to send an HTTP request of some kind to the server and have it run the command there instead (using child_process.exec()/child_process.spawn()).

Best way to trigger a Node-RED flow from python script [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm running Node-RED on a raspberry pi. I want to trigger a flow at the end of a python script I'm running on the same rpi. What's the easiest input node to trigger and what would be an example of the python code to use with it? I'd like to pass a string variable back
Taking best to be easiest then the http-in node is probably best
And using something like this will work:
import urllib2
urllib2.urlopen("http://localhost:1880/start").read()
Where the http-in node has been configured to listen on /start

Python workers in Rails [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm building rails application, I have workers from other project, they called ironworker and written on Python. Is it possible to use this workers in Rails application?
As one of solution, I'm going to use other worker - resque, but can I execute Python scripts?
Thanks for help, I have no idea from what I should start
As I understand from the docs of ironworker, python workers can be run from command line.
exec 'hello_worker.py'
This post explain how you can do it:
Calling shell commands from Ruby.
For example you can call python workers in your rescue worker:
class ImageConversionJob
def work
system("exec 'hello_worker.py'")
end
end

Categories