0

In recent Linux distributions, systemd has replaced the traditional /etc/init.d scripts. And it can support user services systemctl --user start my.service

I wonder if we can do similar things with init scripts? i.e. let a service run by a regular user when the system boots up

3
  • Have you tried it?
    – DEKKER
    Sep 28, 2022 at 13:15
  • Do you mean that you are running some rc-like init system OR ( that you are running a systemd init system and ( would want to start systemd services the rc way ? OR would want to start rc-like services ? ))
    – MC68020
    Sep 28, 2022 at 14:30
  • Hey, DrizzleX, I'm sorry, but it's really not clear what you'd like to do. Can you give us a concrete example of what you want to do? What you describe sounds illogical. May 15, 2023 at 12:26

1 Answer 1

0

Any initscript can run any command as any user just by using su $user -c "/home/$user/onboot.sh". And that would just launch a user script on boot, to which they can run whatever they want. If I wanted to provide a user a facility like systemd user services, I would give them supervisord, and write a initscript to autostart it on boot. Of course, they could do something similiar themselves just by creating a cronjob that runs ever minute that starts supervisord if it is not running already. That will work just the same without any initscript.

1
  • I'm not sure I rightly understood the question. Anyway ! Whatever my understanding, you just cannot write " ... launch a user script on boot, to which they can run whatever they want ". Whatever, whatever… The order in which services are launched should be considered in case the service being launched requires other services being already launched or/and this service is needed by other services that should be launched after.
    – MC68020
    Sep 28, 2022 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .