Re: [systemd-devel] Need help with setting up systemd for Apache on Debian 10

2020-08-24 Thread Tom Browder
On Sun, Aug 23, 2020 at 12:19 PM Tom Browder  wrote:
> There is no official Apache systemd setup for Apache from source, and
...

My original post was too harsh. My requests for help haven't been very
clear. Thanks to hints and questions here, I took the time to do a
little scarier experimentation with my live Apache installation and
now have a service file that seems to work. In it I have added
documentation to refresh tired and failing memories:

$ cat apache2.service
# Debian 10 installation instructions:
#
# See systemd documentation in:
#
#   man systemd.unit
#   man systemd.service
#
# Place a copy of this file into:
#   /etc/systemd/system/
#
# After creating or modifying any unit files, we must tell systemd
# that we want it to look for new things:
#
#   # systemctl daemon-reload
#
# Our new service should be recognized at this point, but it won't run
# yet. We need to do two more things. First, tell systemd to enable
# it, so that it will start every time we boot:
#
#   # systemctl enable apache2.service
#
# Second, start it now:
#
#   # systemctl start apache2.service
#
# Note that you don't get feedback from this command, because all it
# does it send a message to systemd telling it to start your
# service. The command you typed doesn't hang around to see what
# happens next. You may use systemctl status myservice.service (or
# systemctl status myservice) to check on your service, to make sure
# it seems OK.
#
#   # systemctl status apache2.service
#   # systemctl status apache2
#
# Also note that systemctl status myservice gives more information if
# you run it as root, compared to running it as a normal user.

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/local/apache2/bin/apachectl -k start
ExecStop=/usr/local/apache2/bin/apachectl -k stop
ExecReload=/usr/local/apache2/bin/apachectl -k graceful
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target
# EOF

Thank you.

-Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Need help with setting up systemd for Apache on Debian 10

2020-08-23 Thread Reindl Harald



Am 23.08.20 um 19:19 schrieb Tom Browder:
> There is no official Apache systemd setup for Apache from source, and
> I didn't get any help from users there. I tried to mimic a good
> solution by first installing Apache with the Debian package and
> finding all the systemd files with "httpd" or "apache" in the name.
> That resulted in the following list:
> 
> /etc/systemd/system/multi-user.target.wants/apache2.service
> /run/systemd/units/invocation:apache2.service
> /usr/lib/systemd/system/apache2.service
> /var/lib/systemd/deb-systemd-helper-enabled/apache2.service.dsh-also
> 
> /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/apache2.service
> 
> The contents of the "apache2.service" file are:
> 
> [Unit]
> Description=The Apache HTTP Server
> After=network.target remote-fs.target nss-lookup.target
> 
> [Service]
> Type=forking
> Environment=APACHE_STARTED_BY_SYSTEMD=true
> ExecStart=/usr/sbin/apachectl start
> ExecStop=/usr/sbin/apachectl stop
> ExecReload=/usr/sbin/apachectl graceful
> PrivateTmp=true
> Restart=on-abort
> 
> [Install]
> WantedBy=multi-user.target

what is your specific problem?

besdies there is no need for ExecStop at all and you can use type=simple
combined with "-D FOREGROUND"

EnvironmentFile=-/etc/sysconfig/httpd
Environment="PATH=/usr/bin:/usr/sbin"
Environment="LANG=C.UTF-8"
ExecStart=/usr/sbin/httpd $OPTIONS -D FOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful

DUNNO what's about all that useless "deb-systemd-helper"

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Need help with setting up systemd for Apache on Debian 10

2020-08-23 Thread Tom Browder
On Sun, Aug 23, 2020 at 12:36 PM Tomasz Torcz  wrote:
>
...
>   First of all, you got correct installation by installing distribution
> package.  You can stop there.
>   If you want to do the work, anyway, do the following:
>   – read man systemd.unit, systemd.service, maybe some systemd tutorials
>   – devise your own service unit file for apache httd; you have two
> examples already
>   – in your package, install the unit into /usr/lib/systemd/system/

Thanks, Tomasz.

Best regards.

-Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Need help with setting up systemd for Apache on Debian 10

2020-08-23 Thread Tomasz Torcz
On Sun, Aug 23, 2020 at 12:19:15PM -0500, Tom Browder wrote:
> There is no official Apache systemd setup for Apache from source, and
> I didn't get any help from users there. I tried to mimic a good
> solution by first installing Apache with the Debian package and
> finding all the systemd files with "httpd" or "apache" in the name.
> That resulted in the following list:
> 
> /etc/systemd/system/multi-user.target.wants/apache2.service

  That a symlink causing apache httpd to be started on boot.

> /run/systemd/units/invocation:apache2.service

  Internal stuff, ignore.

> /usr/lib/systemd/system/apache2.service

  This is the only file that matters.

> /var/lib/systemd/deb-systemd-helper-enabled/apache2.service.dsh-also
> 
> /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/apache2.service

  This is some Debian stuff.

> The contents of the "apache2.service" file are:

  That's one way correct way to do it. To see other, check httpd.service
as shipped by Fedora: https://src.fedoraproject.org/rpms/httpd/tree/master

 
> I assume the data are correct, and I'm pretty sure there is some
> fancy, automated sysstemctl way to get it all working.  I would
> greatly appreciate some guidance as to how to install the files
> correctly.

  First of all, you got correct installation by installing distribution
package.  You can stop there.
  If you want to do the work, anyway, do the following:
  – read man systemd.unit, systemd.service, maybe some systemd tutorials
  – devise your own service unit file for apache httd; you have two
examples already
  – in your package, install the unit into /usr/lib/systemd/system/


-- 
Tomasz TorczTo co nierealne – tutaj jest normalne.
to...@pipebreaker.pl  Ziomale na życie mają tu patenty specjalne.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Need help with setting up systemd for Apache on Debian 10

2020-08-23 Thread Michael Biebl
Am So., 23. Aug. 2020 um 19:20 Uhr schrieb Tom Browder :

> I assume the data are correct, and I'm pretty sure there is some
> fancy, automated sysstemctl way to get it all working.  I would
> greatly appreciate some guidance as to how to install the files
> correctly.

Those files are installed correctly. What's your specific question?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel