Skip to content

Available, disabled services in list #52

Open

Description

@jackghg

The list command should show also the installed but not enabled, never started services.
And maybe list by status ?

Activity

  1. davmac314 commented on Mar 26, 2022

    @davmac314
    Owner

    The list command should show also the installed but not enabled, never started services.

    This would require dinit (or at least dinitctl) to be able to determine which services have been installed (but not yet loaded). One option would be to assume that every file in the services directory is in fact a service description file, but that seems liable to cause issues; or, attempt to parse every such file as a service description in order to weed out non-service-description files, but that seems like an ugly solution and doesn't completely solve possible issues anyway; or, to have a separate file listing all installed services, which is less prone to accidental confusion between service and non-service but which requires this file to be updated appropriate when services are installed or uninstalled. This latter would be my preferred approach, and patches implementing this are welcome.

    And maybe list by status ?

    Sure, patches welcome for this too.

  2. jackghg commented on Mar 26, 2022

    @jackghg
    Author

    Thanks, on a second thought, im not sure if this is the wanted behavior when someone do list... Maybe an option to include them like systemd --all. Or another app is also a good idea. Check if the services are valid is also usefull... even if to do that you just have to try to start it... well an app can check multiple...

    I think that the problem to fix here is, "whats the name of the service of the package i installed ?"

  3. jackghg commented on Mar 28, 2022

    @jackghg
    Author

    It could be just an app that lists the files in the 2 or 3 folders where dinit looks for services. Or it could be a kind of a diagniostic tool. Or do nothing is also an option...

  4. davmac314 commented on Mar 31, 2022

    @davmac314
    Owner

    Have thought about it a bit more. I think it makes sense to add an --all option to dinitctl list that causes it to display all non-executable files in the description directories as potential services (probably with some name-based filtering, eg excluding files beginning with dot). It is a better experience for the users if they have this option and it's unlikely that other files should end up in the service directories anyway.

  5. jackghg commented on Mar 31, 2022

    @jackghg
    Author

    good!

  6. jackghg commented on Apr 20, 2022

    @jackghg
    Author

    A step back, how to list the running services ?
    On my artix it shows all the services that has ever started (around 40) and all with the same status, started, must be something broke.

  7. davmac314 commented on Apr 20, 2022

    @davmac314
    Owner

    dinitctl list shows all loaded services regardless of their state. The leading glyphs indicate service state, eg [ {-}] samba-smbd means that samba-smbd is a stopped service, check man dinitctl for more information. There is no way currently to restrict the list to only running services.

    You can also use dinitctl status <servicename> to check the state of a single service though that is not completely reliable with the last release due to a bug (it may give an error message, which means nothing about the state of the service; since been fixed in development).

    With all above in mind, if dinitctl list is showing all services as started even though some are definitely not currently running, that would be a bug. However, it works fine for me. Try stopping a specific service and re-check status just to be sure.

  8. jackghg commented on Apr 20, 2022

    @jackghg
    Author

    that was fast! It shows [{+} ] for all the 49 services.
    The status of a ghost service gives an error, after I stop the service (both running and non running) list shows the correct stopped status.

    Some service has pid:xxx but not all of the really running services.

  9. jackghg commented on Apr 20, 2022

    @jackghg
    Author

    what services should be shown ? I think, the running services, the enabled services, the manually started and stopped services ? idk , the manually started one-shot services ? idk.

    Maybe the "system services" could be hidden, and shown only if the future "--all" option is set ?
    By system services i mean the services that are built-in dinit and mandatory.

  10. davmac314 commented on Apr 20, 2022

    @davmac314
    Owner

    that was fast! It shows [{+} ] for all the 49 services.
    The status of a ghost service gives an error, after I stop the service (both running and non running) list shows the correct stopped status.

    Ok so it sounds like all services are running and correctly showing as running.

    Some service has pid:xxx but not all of the really running services.

    Only process and bgprocess services can have a pid associated.

    Maybe the "system services" could be hidden, and shown only if the future "--all" option is set ?
    By system services i mean the services that are built-in dinit and mandatory.

    There aren't any services built-in to dinit. The only (somewhat) mandatory service is "boot". The services you are seeing are what the distribution provides

  11. jackghg commented on Apr 21, 2022

    @jackghg
    Author

    There aren't any services built-in to dinit. The only (somewhat) mandatory service is "boot".

    Some example: loginready, setup, cleanup, pseudofs, sysusers, vconsole, mount, hostname, misc, modules...
    I dont think that one wants to see these when run list... maybe im wrong... How can I call these services ? internal ? os init services ?

  12. davmac314 commented on Apr 21, 2022

    @davmac314
    Owner

    Dinit doesn't make any distinction between these services and other services. I think such functionality would have to be part of an external tool. I guess I consider this out-of-scope for DInit itself.

  13. added
    C-dinitctl
    Feature Request
    on Aug 6, 2022
  14. kopavel commented on Jan 28, 2023

    @kopavel

    If service don't have any PID-file or ServiceStop command - we can interpret that service as "one time command" (or have a specific "not script" type for that) and those service are immediately "stopped" after command end.

  15. jackffmm commented on Jun 6, 2023

    @jackffmm

    I'm the OP, this is my new account.

  16. dropwhile commented on Jan 22, 2025

    @dropwhile

    @davmac314 I ran across this issue when searching for a way to list available installed services (ones that are not already enabled). As this issue is a bit dated already, I'm not sure if this has been solved and perhaps I am just unaware of it.. or if it has been deemed as undesirable or unnecessary functionality.

    # os: chimera linux
    # dinitctl --version
    Dinit version 0.19.4pre.
    

    As an example, I have rsync installed, a service files gets installed along with it to /lib/dinit.d/rsyncd, and the service is not enabled, and as such does not show up in dinitctl list.

    It would be handy to have a list-available or list --available to show the names of services in dinit readable service directories (dinit.d) that are not currently enabled. This is useful when I install something and when the service name is not the same as the package name, or if I happen to install something and only later decide to enable it.

    Currently I use this in a shell alias, but it is a bit of an abomination:

    diff -au \
        <(dinitctl list 2>&1 | sed -E 's/^\[.*\] ?//g' | grep -v '@' | awk '{print $1}' | sort) \
        <(fd -tf --maxdepth 1 --format {/} . /etc/dinit.d /lib/dinit.d | sort) \
        | grep -E -- '^\+[^+]+' | tr -d '+'
    
  17. davmac314 commented on Jan 26, 2025

    @davmac314
    Owner

    @dropwhile it's an open issue, therefore: it has not been resolved, and it is considered worth doing something about. If it was resolved the issue would be marked as closed.

    That said, it's not high priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Importance: NormalC-dinitctlFeature Request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions