Re: Re[2]: error on logging and how to correctly implement svlogd?
Very interesting that after I change to symlink, it works fine, thanks.
On Jun 22, 2016 11:55 PM, "Avery Payne" <avery.p.payne_at_gmail.com> wrote:
>
> Hi,
>>
>> Thanks for replying. I don't use symlink, instead I put everything
>> directly
>> on /etc/service/test, then sv start test
>>
>> Try this:
>
> mkdir /etc/svcdef
> mkdir /etc/svcdef/test
> mkdir /etc/svcdef/test/log
>
> Put a copy of your test service ./run file into the new directory:
>
> cp /etc/service/test/run /etc/svcdef/test/run
>
> Now open an editor like this:
>
> vi /etc/svcdef/test/log/run
>
> and put this into it:
>
> #!/bin/sh
> exec 2>&1
> # extract the service name
> SVNAME=$( basename $( echo `pwd` | sed 's/log//' ) )
> # create a logging directory if one isn't present
> [ -d /var/log/$SVNAME ] || mkdir -p /var/log/$SVNAME ; chown :adm
> /var/log/$SVNAME
> # create a hard-coded path name to reference
> [ -d main ] || ln -s /var/log/$SVNAME main
> # launch the logger
> exec /usr/bin/svlogd -tt main
>
> after that, save the file and exit the editor, and do the following:
>
> mkdir /etc/sv
> cp -Rav /etc/svcdef/* /etc/sv/
> ln -s /etc/sv /service
>
> Now start your supervision and make sure it's pointing at /service instead
> of /etc/service. Type
>
> ps fax
>
> ...and you should see a supervision "tree" complete with your test service
> and logger. You don't have to use /etc/svcdef or /etc/sv or even /service,
> I'm just giving these as suggestions. For that matter the logger could
> even be switched out, the logging done elsewhere, etc.
>
> The logging needs to start using a subdirectory of the service. In this
> case, the service is /etc/sv/test and the logger would be
> /etc/sv/test/log. A ./run file needs to be present in the log directory to
> launch the logger, which is the script we just created at
> /etc/svcdef/test/log/run.
>
> Hope this helps.
>
>
Received on Thu Jun 23 2016 - 00:32:49 UTC
This archive was generated by hypermail 2.3.0
: Sun May 09 2021 - 19:44:19 UTC