/var/log im tmpfs - automatisch Unterverzeichnisse anlegen

Florian Lohoff f at zz.de
Sun Feb 4 12:14:59 CET 2018


On Thu, Feb 01, 2018 at 10:24:44PM +0100, Stefan U. Hegner wrote:
> Moin Flo
> Aber kann ich das direkt in der
> 
>     /lib/systemd/system/nginx.service
> 
> unterbringen?

So hätte ich das gemacht

>     # Create log directory if not available
>     if [ -d /var/log/nginx ]; then
>             echo "nginx logdir already exists.";
>     else
>             mkdir /var/log/nginx;
>     fi;

mkdir -f /var/log/nginx

erzeugt es wenn es nicht da ist und failed nicht wenn es schon da ist.
Alternativ auch

[ ! -d /var/log/nginx ] || mkdir /var/log/nginx


>     ExecStartPre= /usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
>     ExecStart= /usr/sbin/nginx -g 'daemon on; master_process on;'

IMHO kannst du ExecStartPre mehrfach angeben die dann nacheinander
ausgeführt werden.

Flo
-- 
Florian Lohoff                                                 f at zz.de
             UTF-8 Test: The 🐈 ran after a 🐁, but the 🐁 ran away
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20180204/abe74002/attachment.sig>


More information about the Linux mailing list