[systemd-devel] Auto-start of a Service in systemd
Raghavendra. H. R
raghuhr84 at gmail.com
Wed Oct 5 09:42:54 UTC 2016
I ran *"systemctl enable test.service" *but when I restart it shows only
that the service is only enabled but not active and running.
Here is the status of test.service
*? test.service - Hey Bings*
* Loaded: loaded (/lib/systemd/system/test.service; enabled)*
* Active: inactive (dead)*
For *WantedBy= *which attribute should be given, whether it is
"default.target" or the default target of the system ?
Running *systemctl get-default* shows graphical.target as the default
target.
--
Regards,
Raghavendra. H. R
(Raghu)
On Wed, Oct 5, 2016 at 2:59 PM, Andrei Borzenkov <arvidjaar at gmail.com>
wrote:
> On Wed, Oct 5, 2016 at 12:23 PM, 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
> > automatically.
> >
> > 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.
> >
>
> There is no such thing as "own systemd services". All services are
> equal (but some are more equal than others :)
>
> > Can anyone help me regarding this ?
> >
> >
> > My sample service
> > =============
> > [Unit]
> > Description=Hey Bings
> >
> > [Service]
> > ExecStart="Run an executable"
> >
> > [Install]
> > WantedBy=multi-user.target or sysinit.target
> >
>
> sysinit.target is wrong, it should never be used for normal service.
> multi-user.target should work as long as it is your default target (or
> dependency of default target).
>
> You did run "systemctl enable your.service", did not you? What
> "systemctl status your.service" says?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20161005/3177e0ee/attachment.html>
More information about the systemd-devel
mailing list