Open richibrics opened 1 year ago
There are a some problems in that module for Windows and Linux:
/etc/init.d
), this folder exists for backward compatibility reasons. Most Linux distros use systemd nowadays, which uses unit files instead of shell scripts. None of my Linux machines have that folder, I guess it's a Ubuntu specialty.Maybe I will create a PR for fixing the linux features, as I need that.
Yes I saw that there are some problems so I was building something similar on my own (look at runonboot repo). I have to add Linux and Windows (this one is the next I do).
Needs RunOnBoot completion
Related: I documented here how I run IoTuring with systemd in a venv: https://github.com/infeeeee/IoTuring/blob/autostart/docs/Tips.md#run-as-a-service-on-linux-with-systemd
Really nice, thank you
in Windows just make a startup task to run py -m IoTuring
in Windows just make a startup task to run
py -m IoTuring
What if you want to run it as a service? Ideally you want to restart IoTuring automatically if it stops. What if you installed with pipx? What if you downloaded a prebuilt executable (will be available in the future, I started working on it). There are even multiple startup folders one for admin and one per regular user. You cannot be sure if a task is run successfully, and it won't restart. You can also start scripts with group policy, so you can autostart on all of your computers in your domain, maybe it's a better option for some users.
A lot of things can go wrong, and there are a lot of ways you can start a program automatically on windows. There is a reason this was not implemented yet in this project.
But I think IoTuring should run as a service, regardless of platform, that's what a service was meant for, not as a task.
For manually creating services on windows my favorite tool is NSSM: https://nssm.cc/download Services can restart automatically, can start before a user logs on, and you have much more options. But I think we should look for some command line options instead of NSSM, windows has some tools for that, I used it a long time ago.
@infeeeee are you using a local user to run the service? not sure it's able to run as local system, I was having that issue when using Tasks as well.
My only account doesn't have a local pw (MS acct) - I'll make a user if needed, just want to avoid extra tid bits if not needed. Here is my command
nssm.exe install IoTuring-Integration "C:\Users\userAcct\AppData\Local\Programs\Python\Launcher\py.exe" "-m IoTuring"
@warmfire540 Currently I don't yet run this project as a service on windows, but I played with these things a lot some time ago on other projects.
OK I finally got this working - thanks all for the help!
@warmfire540 Can you write down what you did? Maybe it would helps others in the future. Thanks!
I think the script autostart at boot is a must have feature.
Need "autostarter" developer to accept my PR.