Re: Rare runsv logging problem

From: Alex Efros <powerman_at_powerman.name>
Date: Sat, 26 Jul 2014 12:44:23 +0300

Hi!

On Fri, Jul 25, 2014 at 11:16:50PM -0700, Caleb Spare wrote:
> run:
>
> #!/bin/sh
>
> mkdir -p /mnt/log/baz
> chown -R user1 /mnt/log/baz
> cd /opt/baz/current
> exec chpst -u user1 ./run_baz 2>&1
>
> log/run:
>
> #!/bin/sh
>
> # The main run script takes care of ensuring the log dir exists.
> exec svlogd -ttt /mnt/log/baz/

I believe ./run and ./log/run are started simultaneously, so svlogd may
run before mkdir or between mkdir and chown. I'm not sure this may result
in having no logger at all as you explained because if svlogd fail it
should be restarted. Anyway, I think you should move mkdir from ./run to
./log/run.

Also it doesn't clear why you change owner of log directory to "user1" -
usually log directory is owned by user "log" (and svlogd run as user
"log") while your service run using some other user (this suppose you
didn't try to access log directory from your application).

So, maybe you should try this:

--- ./run:
#!/bin/sh
cd /opt/baz/current
exec chpst -u user1 ./run_baz 2>&1

--- ./log/run:
#!/bin/sh
mkdir -p /mnt/log/baz
chown -R log /mnt/log/baz
exec chpst -u log svlogd -ttt /mnt/log/baz/

-- 
			WBR, Alex.
Received on Sat Jul 26 2014 - 09:44:23 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC