Skip to content

Conversation

@richibrics
Copy link
Owner

I think the script autostart at boot is a must have feature.

Need "autostarter" developer to accept my PR.

@infeeeee
Copy link
Collaborator

There are a some problems in that module for Windows and Linux:

  • On Windows no support for services. Autostart folders only scanned at user logon, while services run from boot, useful for a monitoring programs like IoTuring.
  • On Linux it uses the SysVinit dir (/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.

@richibrics
Copy link
Owner Author

richibrics commented Jan 26, 2023 via email

@richibrics richibrics force-pushed the main branch 3 times, most recently from 3c7d915 to 64912b5 Compare January 28, 2023 23:46
@richibrics richibrics added enhancement New feature or request stale WIP and removed WIP labels Nov 27, 2023
@richibrics
Copy link
Owner Author

Needs RunOnBoot completion

@infeeeee
Copy link
Collaborator

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

@richibrics
Copy link
Owner Author

Really nice, thank you

@warmfire540
Copy link

in Windows just make a startup task to run py -m IoTuring

@infeeeee
Copy link
Collaborator

infeeeee commented Jan 2, 2024

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.

@warmfire540
Copy link

@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"

@infeeeee
Copy link
Collaborator

infeeeee commented Jan 3, 2024

@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.

@warmfire540
Copy link

OK I finally got this working - thanks all for the help!

@infeeeee
Copy link
Collaborator

infeeeee commented Jan 7, 2024

@warmfire540 Can you write down what you did? Maybe it would helps others in the future. Thanks!

@infeeeee infeeeee mentioned this pull request Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants