You are not logged in.

#1 2013-02-14 06:07:39

dfr
Member
Registered: 2013-02-14
Posts: 4

mkdir at startup, stuck with systemd

Hello, i have /var/log dir on ramdisk, so every time system boots it is emtied, its fine, but nginx do not like it:

 Starting A high performance web server and a reverse proxy server...
nginx: [alert] could not open error log file: open() "/var/log/nginx/err...ctory)
2013/02/14 09:50:04 [emerg] 1373#0: open() "/var/log/nginx/access.log" f...ctory)
nginx.service: control process exited, code=exited status=1

Then i decided to edit startup file /usr/lib/systemd/system/nginx.service and add extra ExecStartPre line:

ExecStartPre=mkdir /var/log/nginx
...

But this resulted no effect: the error still there, so systemd man page claim that ExecStart can contain few commands delimited with ";", then i replaced this:

ExecStart=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'

with this:

ExecStart=mkdir /var/log/nginx; /usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'

and sadly still no positive effect, directory not created. When i create it by hand, then nginx starts fine.
Any idea what i'm doing wrong ?

Offline

#2 2013-02-14 06:30:08

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: mkdir at startup, stuck with systemd

Why make /var/log a ramdisk? Wouldn't that be (very) counter-productive if/when you actually need such logs after a crash?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2013-02-14 09:38:49

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: mkdir at startup, stuck with systemd

Aside from ngoonee's point, you're best off using temp files - https://wiki.archlinux.org/index.php/Sy … rary_files
See also "man tmpfiles.d"


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#4 2013-02-16 05:57:08

dfr
Member
Registered: 2013-02-14
Posts: 4

Re: mkdir at startup, stuck with systemd

skanky wrote:

Aside from ngoonee's point, you're best off using temp files - https://wiki.archlinux.org/index.php/Sy … rary_files
See also "man tmpfiles.d"

Thanks a lot,  tmpfiles.d solved my problem.

Offline

#5 2013-02-16 06:32:02

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: mkdir at startup, stuck with systemd

Please mark the thread [Solved]


I laugh, yet the joke is on me

Offline

Board footer

Powered by FluxBB