Re: Question on systemd service and "After=" directive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 03.03.17 10:18, Dario Lesca (d.lesca@xxxxxxxxxx) wrote:

> Gogs systemd service (gogs.service) must start after a DB is started.
> 
> Gogs can use mysql, mariadb, postgress, ecc db backend.
> 
> Now into service all this "After=" are commented and I must modify the
> gogs.service file and comment out the right After entry
> 
> > [Unit]
> > Description=Gogs
> > After=syslog.target
> > After=network.target
> > #After=mysqld.service
> > #After=mariadb.service
> > #After=postgresql.service
> > #After=memcached.service
> > #After=redis.service
> > 
> > [Service]
> https://github.com/gogits/gogs/blob/master/scripts/systemd/gogs.service
> 
> Now I have modify the gogs.service file, but I'm looking for a way to
> avoid modify the unit file
> 
> It's possible set After with all db service gogs needs, also if the
> some named services are non installed, something like this, or leave
> all After= directive uncommented:
> 
>     After=aaa.service bbb.service ccc.service
> 
> If not, there is a way to avoid modify the unit file and put into it
> something like this?
> 
>     AfterIfExist=aaa.service bbb.service ccc.service
> 
>     or another directive ?
> 
>     Many thanks for your suggest.

It's entirely OK to order yourself after non-installed units. Simply
list the After= lines you need, and all is good. After= has no effect
if the specified unit doesn#t exist and generates no errors. It's
intended use of this option to reference non-existing units.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux