Is it possible for a python script to execute at a low run level?
Edit: To clarify, is it possible for a python script to run in the background, kind of like a daemon.
Is it possible for a python script to execute at a low run level?
Edit: To clarify, is it possible for a python script to run in the background, kind of like a daemon.
I put this file nice.py
in my site-packages directory (on Windows):
import win32api,win32process,win32con
pid = win32api.GetCurrentProcessId()
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, win32process.BELOW_NORMAL_PRIORITY_CLASS)
Then I just import nice
on any script I want to run at reduced priority.
I'm sorry my question was unclear. I meant to ask if it was possible for a python script to run in the background, kind of like a daemon. (Linux)
Yes. The scripts that control daemons are (normally) plain old bash scripts and can run whatever a bash script can run. The only difference is that in a low runlevel, lots of other system services will not be running, so if the program tries to do something that depends on another daemon, that may fail.