LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Output to a text file at startup? (https://www.linuxquestions.org/questions/debian-26/output-to-a-text-file-at-startup-771002/)

drydo 11-23-2009 10:07 AM

Output to a text file at startup?
 
I'm not terribly experienced on Debian but I'm guesing this should be a pretty simple.

I've got a minimal Debian installation running with LXDE and Openbox - I've created a daemon using Mono and I would like to save its output to a textfile. In a script or terminal I can use...

mono ./MyDaemon.exe > output.txt

...however, when I place this in my autostart script (which successfully starts up the daemon) it fails to generate the output file. Note: I'm using the /etc/xdg/lxsession/LXDE/autostart to add my line and start up my daemon. I've checked execute and write permissions and everything looks ok...

Does anyone have any ideas why it successfully starts the daemon but doesn't create the textfile?

Thanks in advance...

catkin 11-23-2009 10:24 AM

Because its current working directory is not what you think it is?

What happens if you add echo "$(pwd)" > "/tmp/${0##*/}.$$" at the beginning of the script and/or change the name of the log file to something with a full path, that is beginning with /

$0 is the name of the script. The weird stuff strips of any directory names. $$ is the process ID (PID) of the running script.

drydo 11-23-2009 10:25 AM

I've used full directory paths and had no luck so far :(

drydo 11-23-2009 11:11 AM

Thanks for the help - but I managed to crack it by pointing the autostart script to a shell script and executing that. Seems to be fine :)


All times are GMT -5. The time now is 08:27 AM.