[Voyage-linux] log the stdout of a process started by start-stop-daemon
Francisco José Sánchez
(spam-protected)
Wed Mar 28 00:13:14 HKT 2012
Hello Toni,
2012/3/27 Toni Castelli <acastelli at keonn.com>
> Hello, I’m having some trouble trying to log the stdout and the
> stderror generated by an application when it is started by an init.d
> script.
>
> What im trying to run is something like this:
>
> $logFile=/var/log/test.log
>
is wrong variable assignation (really is a error in your script o is a
error the transcription email?)
logFile=/var/log/test.log
>
> if [ ! "$logFile" == "" ]; then
> touch $logFile || exit 2
> start-stop-daemon --start --make-pidfile --pidfile
> $PIDFILE --exec $DAEMON -- $DAEMON_ARGS >> $logFile 2>&1 &
> else ....
>
>
when you verify exists a file, use param -f . Example
if [ -f $logFile ]; then
<code true>
else
<code false>
fi
or this other example
if [ ! -f $logFile ]; then
<code false condition>
else
<code true condition>
fi
but I don't know what yo want to do.
when I try to run the script from bash it works perfectly, but when it runs
> after a reboot, the log file isn’t generated. I’m suspecting it could be a
> matter of mounting the file system after starting my script, but I’ve
> checked the execution number and its the last one it shares the number with
> some other processes). Anyone can guess what’s wrong with the code?
>
best regards.
PD: Excuse me English language, but spanish user ;-)
> _______________________________________________
> Voyage-linux mailing list
> Voyage-linux at list.voyage.hk
> http://list.voyage.hk/mailman/listinfo/voyage-linux
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20120327/e9a18ea3/attachment.html>
More information about the Voyage-linux
mailing list