LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-28-2011, 01:53 PM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Rep: Reputation: 196Reputation: 196
How to force conky to print the data to a file (overwrite not append)?


I prepared the ~/.conkyrc file using the following configuration:

Code:
out_to_x no
cpu_avg_samples 2
net_avg_samples 2
no_buffers yes
out_to_console yes
out_to_stderr no
extra_newline no
update_interval 3.0
uppercase no
use_spacer none
As a result conky command prints data to STDOUT.

Now Iíd like to redirect the output of conky to a file.

The command:

conky > file.tmp

appends the data to the given file.

So it works as:

some_command >> some_file

instead of:

some_command > some_file

I know I can run repeatedly the commands:

conky -i 1 > file.tmp
sleep 3

to achieve the result Iíd like to achieve but I prefer to run conky once as a daemon in the background instead of running it repeatedly using a shell script.

So my question is: how to force conky to print the data to a file (overwrite not append)?
 
Old 11-28-2011, 04:02 PM   #2
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Original Poster
Rep: Reputation: 196Reputation: 196
I found the solution:

Code:
out_to_x no
cpu_avg_samples 2
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
update_interval 3.0
uppercase no
use_spacer none
overwrite_file /home/w1k0/file.tmp
The setting:

Code:
overwrite_file /home/w1k0/file.tmp
writes the data to the /home/w1k0/file.tmp file. Itís necessary to declare the full path to the file because ~/file.tmp and $USER/file.tmp file names donít work with that option.

The setting:

Code:
out_to_console no
suppresses writing the data to STDOUT.

So now the command:

conky

writes the data to the /home/w1k0/file.tmp file and donít display it on the desktop nor on the console.

The problem is solved.
 
1 members found this post helpful.
Old 11-28-2011, 04:26 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,619
Blog Entries: 2

Rep: Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076
Thanks for posting back your solution, you solved my problem here with it.
 
Old 11-28-2011, 09:27 PM   #4
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,240

Original Poster
Rep: Reputation: 196Reputation: 196
I’m glad it works for you too. Within last few years I noticed I’m the only one that solved the problems I posted here. I think the problems that appear on a high level of computing are so sophisticated that only the person that encounters these problems has enough motivation to solve them.
 
Old 11-28-2011, 11:50 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,619
Blog Entries: 2

Rep: Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076Reputation: 4076
Might be true for some problems, especially when it comes to problems for rarely applied use cases or rarely used software. Actually I had only very few threads here where I couldn't get help from a knowledgeable member.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
trying to append data to a file with php/fwrite steve51184 Linux - Server 2 08-16-2010 09:35 PM
[SOLVED] Network manager overwrite resolvconf vpn data with eth0 data rein2red Debian 1 03-21-2010 03:14 PM
c++ append data to file blizunt7 Programming 3 07-04-2005 01:47 AM
Force grep NOT to print file names smart_sagittari Linux - Newbie 5 04-25-2005 02:20 AM
urpmi force reinstall/overwrite ryedunn Mandriva 1 01-28-2005 02:11 AM


All times are GMT -5. The time now is 09:14 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration