AnswerBun.com

How can I define a systemd target to start on boot or after another target

Unix & Linux Asked by Subtubes on January 5, 2022

I would like to know how I can define in a unit file for a systemd target i.e. /etc/systemd/system/sample.target

that it should be run at the multi-user.target level.

In a unit file for a service I might do something like this

[Install]
WantedBy=multi-user.target

In a target this would clearly not work so I am wondering how I could define this for a target.

I would like to create a target that runs as if it is WantedBy=multi-user.target

2 Answers

For example

[Unit]
Description=ABRT Automated Bug Reporting Tool
After=syslog.target
[Service]
Type=dbus
BusName=com.redhat.abrt
ExecStart=/usr/sbin/abrtd -d -s
[Install]
WantedBy=multi-user.target

Answered by Dmitry Lvov on January 5, 2022

[Install]
WantedBy=multi-user.target
In a target this would clearly not work

It works just fine for targets such as remote-fs.target; and the systemd.target manual page is clear that the [Install] section is valid in target units. So use it.

Answered by JdeBP on January 5, 2022

Add your own answers!

Related Questions

convert a html book to a pdf file?

4  Asked on December 10, 2021

   

How do I kill an IRQ process in Linux?

3  Asked on December 10, 2021 by tmit

       

How to install gtk3 in CentOS?

1  Asked on December 10, 2021 by prashanth-sams

         

Swapfile Swapon invalid argument

2  Asked on December 10, 2021 by simernes

     

What does the Broken pipe message mean in an SSH session?

9  Asked on December 8, 2021 by peter-stuifzand

 

Ext4 All data deleted, can’t recover

0  Asked on December 8, 2021 by jean-christophe-richter

         

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP