[systemd-devel] Auto-start of a Service in systemd
lennart at poettering.net
Wed Oct 5 11:18:19 UTC 2016
On Wed, 05.10.16 14:53, Raghavendra. H. R (raghuhr84 at gmail.com) wrote:
> Hi All,
> I'm a newbie in Systemd init system and I'm trying to auto boot/start my
> service in systemd. But my service gets only enabled and it never runs
> I modifying my unit file to depend on sysinit.target and multi-user.target
> by making use of I used *After=* this also didnt help.
> *I would like to do something in my unit file from which systemd starts my
> service automatically after starting it's own system related services. *
> Can anyone help me regarding this ?
> My sample service
> Description=Hey Bings
> ExecStart="Run an executable"
> WantedBy=multi-user.target *or* sysinit.target
You want to use multi-user.target here. "sysinit.target" is only for
special early-boot services.
After dropping in this file use "systemctl enable ..." to hook the
unit into the boot process for subsequent boots. To also start it
immediately, use "systemctl start ...". You may also do both
operations in one go by using "systemctl enable --now ...".
Lennart Poettering, Red Hat
More information about the systemd-devel