LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 11-23-2009, 10:07 AM   #1
drydo
LQ Newbie
 
Registered: May 2009
Posts: 27

Rep: Reputation: 16
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...
 
Old 11-23-2009, 10:24 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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.
 
Old 11-23-2009, 10:25 AM   #3
drydo
LQ Newbie
 
Registered: May 2009
Posts: 27

Original Poster
Rep: Reputation: 16
I've used full directory paths and had no luck so far
 
Old 11-23-2009, 11:11 AM   #4
drydo
LQ Newbie
 
Registered: May 2009
Posts: 27

Original Poster
Rep: Reputation: 16
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
getting colored text output file using C ibabhelix Programming 2 11-04-2009 02:53 AM
Creating text file from ls output lenik Linux - Newbie 4 07-10-2009 05:07 PM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM
in Pascal: how to exec a program, discard text output or send to text file Valkyrie_of_valhalla Programming 6 05-02-2007 09:50 AM
command output to text file? meniscus Linux - Newbie 4 10-05-2006 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration