- What is daemon.exe? Is daemon.exe spyware or a virus?
- Users Opinions
- How to start daemon process from python on windows?
- 3 Answers 3
- What are the behavioral differences between a daemon and a normal process?
- How do we start the daemon?
- Environment info
- What we have tried
- 4 Answers 4
- Not the answer you’re looking for? Browse other questions tagged windows docker or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Python: Running Daemon Processes in Windows7
- 4 Answers 4
- Not the answer you’re looking for? Browse other questions tagged python windows or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
What is daemon.exe? Is daemon.exe spyware or a virus?
How to fix daemon.exe related problems?
1. Run Security Task Manager to check your daemon process
2. Run Windows Repair Tool to repair daemon.exe related Windows Errors
3. Run MalwareBytes to remove persistent malware
File: daemon.exe
A virtual CD/DVD manager, the Virtual Daemon Manager allows you to mount a virtual optic drive so that you can utilize a disk image as if it is running from a physical drive. Daemon.exe runs in the background and detects any iso file accessed through Windows Explorer. It allows the file to be double-clicked and opened as if it was a true physical drive. Daemon Tools is distributed by Disc Soft Ltd. and supported by Microsoft. Founded in 2005, Disc Soft’s primary products are various Daemon software versions.
If you want a detailed security rating about your daemon.exe (and all other running background processes) read the following user opinions, and download the free trial version of Security Task Manager.
Note: Any malware can be named anything — so you should check where the files of the running processes are located on your disk. If a «non-Microsoft» .exe file is located in the C:\Windows or C:\Windows\System32 folder, then there is a high risk for a virus, spyware, trojan or worm infection! Check it out!
Users Opinions
Average user rating of daemon.exe: based on 59 votes. Read also the 41 reviews.
164 users ask for this file. 38 users rated it as not dangerous. One user rated it as not so dangerous. 4 users rated it as neutral. 2 users rated it as little bit dangerous. 14 users rated it as dangerous. 4 users didn’t rate it («don’t know»).
How to start daemon process from python on windows?
Can my python script spawn a process that will run indefinitely?
I’m not too familiar with python, nor with spawning deamons, so I cam up with this:
The process continues to run past python.exe, but is closed as soon as I close the cmd window.
3 Answers 3
Using the answer Janne Karila pointed out this is how you can run a process that doen’t die when its parent dies, no need to use the win32process module.
DETACHED_PROCESS is a Process Creation Flag that is passed to the underlying CreateProcess function.
This question was asked 3 years ago, and though the fundamental details of the answer haven’t changed, given its prevalence in «Windows Python daemon» searches, I thought it might be helpful to add some discussion for the benefit of future Google arrivees.
There are really two parts to the question:
- Can a Python script spawn an independent process that will run indefinitely?
- Can a Python script act like a Unix daemon on a Windows system?
The answer to the first is an unambiguous yes; as already pointed out; using subprocess.Popen with the creationflags=subprocess.CREATE_NEW_PROCESS_GROUP keyword will suffice:
Note that, at least in my experience, CREATE_NEW_CONSOLE is not necessary here.
That being said, the behavior of this strategy isn’t quite the same as what you’d expect from a Unix daemon. What constitutes a well-behaved Unix daemon is better explained elsewhere, but to summarize:
- Close open file descriptors (typically all of them, but some applications may need to protect some descriptors from closure)
- Change the working directory for the process to a suitable location to prevent «Directory Busy» errors
- Change the file access creation mask ( os.umask in the Python world)
- Move the application into the background and make it dissociate itself from the initiating process
- Completely divorce from the terminal, including redirecting STDIN , STDOUT , and STDERR to different streams (often DEVNULL ), and prevent reacquisition of a controlling terminal
- Handle signals, in particular, SIGTERM .
The reality of the situation is that Windows, as an operating system, really doesn’t support the notion of a daemon: applications that start from a terminal (or in any other interactive context, including launching from Explorer, etc) will continue to run with a visible window, unless the controlling application (in this example, Python) has included a windowless GUI. Furthermore, Windows signal handling is woefully inadequate, and attempts to send signals to an independent Python process (as opposed to a subprocess, which would not survive terminal closure) will almost always result in the immediate exit of that Python process without any cleanup (no finally: , no atexit , no __del__ , etc).
Rolling your application into a Windows service, though a viable alternative in many cases, also doesn’t quite fit. The same is true of using pythonw.exe (a windowless version of Python that ships with all recent Windows Python binaries). In particular, they fail to improve the situation for signal handling, and they cannot easily launch an application from a terminal and interact with it during startup (for example, to deliver dynamic startup arguments to your script, say, perhaps, a password, file path, etc), before «daemonizing». Additionally, Windows services require installation, which — though perfectly possible to do quickly at runtime when you first call up your «daemon» — modifies the user’s system (registry, etc), which would be highly unexpected if you’re coming from a Unix world.
In light of that, I would argue that launching a pythonw.exe subprocess using subprocess.CREATE_NEW_PROCESS_GROUP is probably the closest Windows equivalent for a Python process to emulate a traditional Unix daemon. However, that still leaves you with the added challenge of signal handling and startup communications (not to mention making your code platform-dependent, which is always frustrating).
That all being said, for anyone encountering this problem in the future, I’ve rolled a library called daemoniker that wraps both proper Unix daemonization and the above strategy. It also implements signal handling (for both Unix and Windows systems), and allows you to pass objects to the «daemon» process using pickle. Best of all, it has a cross-platform API:
What are the behavioral differences between a daemon and a normal process?
I know that daemons run in the background mostly i.e. they require very less interaction from the user.
Wikipedia lists some of the types of daemons that commonly exist:
- Dissociating from the controlling tty
- Becoming a session leader
- Becoming a process group leader
- Staying in the background by forking and exiting (once or twice). This is required sometimes for the process to become a session leader. It also allows the parent process to continue its normal execution. This idiom is sometimes summarized with the phrase «fork off and die»
- Setting the root directory («/») as the current working directory so that the process will not keep any directory in use that may be on a mounted file system (allowing it to be unmounted).
- Changing the umask to 0 to allow open(), creat(), et al. calls to provide their own permission masks and not to depend on the umask of the caller
- Closing all inherited open files at the time of execution that are left open by the parent process, including file descriptors 0, 1 and 2 (stdin, stdout, stderr). Required files will be opened later.
- Using a logfile, the console, or /dev/null as stdin, stdout, and stderr
I want to know if there can be any differences in behavior in a daemon as differentiated from a normal process, apart from the one I mentioned in the first line. Both kinds of processes do their work, and interact with the user depending on the amount of interaction they need to do their job.
How do we start the daemon?
Running docker info from an elevated PowerShell prompt shows this error:
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. (Emphasis added)
How do we run the Docker daemon from the command line? If that is not possible, how do we run it without restarting Windows? If that is not possible, how do we start it at all?
Environment info
What we have tried
Running docker daemon . It responds as follows:
Command «daemon» is deprecated, and will be removed in Docker 1.16. Please run dockerd directly. exec: «dockerd»: executable file not found in %PATH%
Enabling Hyper-V and restarting the computer.
4 Answers 4
If you’re using Docker for Windows, Then simply start the desktop app installed in C:\Program Files\Docker\Docker\Docker Desktop.exe
You can also stop Docker for Windows and run just the Docker daemon dockerd.exe . That’ll only let you run Docker Windows Containers. dockerd.exe is in the program files directory.
Docker daemon on Windows Server run as windows service. This Docker service may not be running on your machine. Follow below steps
Search for service named «Docker»
If you have installed docker on Windows 10 Pro with Hyper-V enabled and still you are not able to run Docker on Windows 10, then as the error suggests that your docker daemon is not started. Follow following steps it helped me to start docker successfully
- Use command on CMD(Admin mode) docker-machine restart default then you will get msg like «open C:\User
.docker\machine\machines\default\config.json: The system cannot find the file specified.»
Go to the docker icon which will be on your windows tray(Right corner of the desktop). Then Right click on the docker icon -> setting-> Reset -> Restart Docker It will take few moments then you will see the message «Docker is running with the green indicator».
Note- If you have already had running Docker containers running on your system then don’t follow these steps. You may lose the exiting containers.
I had the same issue in windows 7. I found my issue was getting the VM working in virtual box.
Then I could run the start.sh in cygwin or Gitbash.
Note: I had to restart any cmd’s for the docker to see the VM.
Not the answer you’re looking for? Browse other questions tagged windows docker or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Python: Running Daemon Processes in Windows7
I had a program that Scraped certain data from certain Web-Pages, and when the Web-Pages changed, acted accordingly.
How would one set up the program so it continues to run in the background?
I don’t need any specifics
I’m just really confused on this concept and would appreciate whatever help anybody has to offer.
4 Answers 4
start path-to-pythonw.exe your-code.py
pythonw means without console.
start means start on background.
if your python is installed system-wide, you can probably start your-code.pyw
.pyw is associated with pythonw.exe
remember you cannot use print (to stdout) in this case.
If you want to be able to just start your process and have it background itself and do a few more typical things that «daemon» processes do in Unix, look here: How do you create a daemon in Python?
There is no concept of «background» in Windows. But the UNIX shell concept of a background process can be reasonably emulated by running your Python script as a Windows service. There are a couple of suggestions in this question: Is it possible to run a Python script as a service in Windows? If possible, how?
For casual use, I suggest that you learn how to use srvany from the second answer.
You simply need to leave your program running! Please google «python daemon» and see how to implement a persistent background process in Python.
Now, you cannot know when a website changes unless you poll it. If the website is well designed, the page you are trying to poll will have a «Last-Modified» header, you can make a «HEAD» request every so often (be nice: don’t poll like crazy) and act when Last-Modified is >= than the one on record. If the site is not well designed, it will not have a reliable Last-Modified or ETAG header, in that case you will have to parse manually and check for changes yourself.
Not the answer you’re looking for? Browse other questions tagged python windows or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.