Skip to content

[DRAFT] service: add autostart option#265

Open
jdiez17 wants to merge 1 commit intoFedericoPonzi:masterfrom
raccoon-os:autostart
Open

[DRAFT] service: add autostart option#265
jdiez17 wants to merge 1 commit intoFedericoPonzi:masterfrom
raccoon-os:autostart

Conversation

@jdiez17
Copy link
Copy Markdown
Contributor

@jdiez17 jdiez17 commented Feb 24, 2025

Motivation and Context

This PR adds an option to autostart services (set to true by default).
We need this in our application to designate services that should not be started by default, only by command.

Description

The change is quite simple: Repo::is_service_runnable() now also checks if service.autostart is true, otherwise it doesn't start it.
I'm not sure that I like the the name Repo::is_service_runnable() (as the service is in fact runnable, but we choose not to run it), or the fact that the service stays in the Initial state when autostart is false and the service is not running.
Your thoughts would be welcome here.

How Has This Been Tested?

Works on my computer ™️
Let me know if you have some thoughts on how to test it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@FedericoPonzi
Copy link
Copy Markdown
Owner

Thanks for the pr! Can you please also update the documentation and the sample service? https://github.com/FedericoPonzi/Horust/blob/master/horust/example_services/sample_service.toml
How do you plan to run them? I'm asking because I haven't had time to look into adding the interface to start and stop services, but only check the current status.
I think current tests passing is a good sign, do you think it would be possible to add an additional (integration?) test for this change?

@jdiez17
Copy link
Copy Markdown
Contributor Author

jdiez17 commented Feb 26, 2025

I will update the docs and example service and add a test for autostart=false.

How do you plan to run them? I'm asking because I haven't had time to look into adding the interface to start and stop services, but only check the current status.

I have implemented a custom "RPC" handler for this. See https://github.com/raccoon-os/rccn_userspace_ws/blob/launch_service/src/rccn_usr_launch/src/launch_service/service.rs#L51-L63

@FedericoPonzi FedericoPonzi force-pushed the master branch 4 times, most recently from e9f47d7 to 0222c55 Compare October 19, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants