Script to run at startup on Windows RT - python

I have a python script which basically lauches an Xmlrpc server. I need this script to run always. I have a function that may call for the system to reboot itself. So once the system has rebooted, I need to get the script running again.
How can I add this to the Windows RT startup?

There is no way for a Windows Store app to trigger a system reboot, neither can it run a Python script unless you implement a Python interperter inside your app. Windows Store apps run in their own sandbox and have very limited means of communication with the rest of the system.

You can create a scheduled task to run on login or boot. The run registry key and the startup folder do not function on Windows RT, but the task scheduler does.
Off topic (since I seem unable to add a comment to the other answer) there has been a copy of Python ported over to Windows RT using the jailbreak.

Related

Is there a way run a python script on another server?

I have a Djnago web application on IIS 6 on one server. Is there a way that from this website I call another python script that is on another server in such a way that that script just run itself there?
Calling or Runnig that script in the usual way as internet says, is not working.
I always get the error of os.getcwd() and it also doesn't allow to change that directory.
I just want to run that python script there on that server from this server.
Can anyone help?
Normally, I would recommend using a framework like fabric or winrm if you want to run a python script on another server. Those frameworks use ssh or windows remoting functionality, respectively, to allow a python program to execute other commands (including python scripts) on other systems. If the target machine is a windows machine, be forewarned that you can run into all sorts of UAC issues doing normal operations.

How to create a "watchdog" for a python script running on a shared host (no ssh access or shell scripts)

My friends and I have written a simple telegram bot in python. The script is run on a remote shared host. The problem is that for some reason the script stops from time to time, and we want to have some sort of a mechanism to check whether it is running or not and restart it if necessary.
However, we don't have access to ssh, we can't run bash scripts and I couldn't find a way to install supervisord. Is there a way to achieve the same result by using a different method?
P.S. I would appreciate it if you gave detailed a explanation as I'm a newbie hobbyist. However, I have no problem with researching and learning new things.
You can have a small supervisor Python script whose only purpose is to start (and restart) your main application Python script. When your application crashes the supervisor takes care and restarts it.

is there any possible way to run a python script on boot in windows operating system?

I want to run a python script which should always start when windows boot.
i believe i can create an executable windows executable file from python by using py2exe... But how to make as a start up service which will be triggered while boot
Is there any way ?
You don't need to create a py2exe executable for this, you can simply run the Python executable itself (assuming it's installed of course), passing the name of your script as an argument.
And one way to do that is to use the task scheduler, which can create tasks to be run at boot time, under any user account you have access to.

Run python application with admin privileges

Working on windows platform, I have a python application which once invoked, remembers its state and resumes in case of system crash or reboot. The application actually runs some other executables or in technological terms is of type framework. The typical scenario where the executable need to run with admin mode passes for first time but fails after resuming from crash or reboot.
What I believe is I need to invoke the resumed application with admin mode. In what way this could be achieved, Thanks in advance!
For Linux, see documentation on upstart (for Ubuntu) or service (for RedHat). The write a start-up script to start your Python script with appropriate rights. You can also configure it to be restarted if it crashes.
Windows has a similar facility for start-up programs, where you can register your program to start.

pywin32 CreateEvent and Apache

I have a website in Django1.1.1 deployed in Apache2.0. In the backend I have a launcher script that starts three python processes that interact with the frontend. One of these processes uses a Windows Event (using CreateEvent) that communicates with Apache.
My problem is that when I run the launcher script first and then start Apache everything seems to be working fine, but when I start Apache first and then run launcher the process with the Windows event is never launched. On starting the process on command line it dies with the error
pywintypes.error: (5, 'CreateEvent', 'Access is denied.')
I think this is a permission issue where Apache is running as SYSTEM user and the launcher running as me. Any ideas how I can fix this?
It could be something else too, any ideas?
I am a noob on Windows so please bear with me. BTW I am using Windows XP and python 2.4
Thanks
S
UPDATE:
I eventually used python recipe Controlling Windows Services to always launch Apache service post my script. My problem is resolved!
Are you specifying a security descriptor in the call to CreateEvent (through the lpEventAttributes argument)?
See the section 5 (Synchronization Object Security and Access Rights) on the following page for details:
Processes and Threads: Synchronization

Categories