Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-26-2005, 08:07 AM   #1
LQ Newbie
Registered: Aug 2005
Distribution: Slackware
Posts: 24

Rep: Reputation: 15
writing to file newbie question

Hi all, i've got smoothwall setup on a box and have a Dshield submittion mod loaded. As a cron job I submit my logs every two hours as such:

0 */12 * * * root /usr/local/bin/ >>/var/log/mailog

How could I attach a command to this so it also logs the time to the file too?
Also I've seen the above command with '2>&1' attached to it. What does this do exactly? Also, if I used the above command and added >/dev/null instead of the maillog, is the intention of this to dump any output of the command before it?
Old 09-26-2005, 08:25 AM   #2
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
standard error (2) is redirected to standard output (1)

will redirect the standard output to the null-device (a black hole); output will not be displayed on screen.

no reply with regards to timestamp
Old 09-26-2005, 10:04 AM   #3
LQ Newbie
Registered: Aug 2005
Distribution: Slackware
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks for that. I've altered the perl script being called to append localtime() to the output. But if anyone knows how to concat a command such as clock to be written to the output file (or even if such a thing is possible) it would be great to know.
Old 09-26-2005, 02:59 PM   #4
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
How about something like

`date` >> blah
(those are `'s, not ''s)


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
Newbie question re: file locations cartwright Mandriva 3 11-20-2005 06:00 PM
Very newbie question - How to use a .bin file durrantj Ubuntu 6 08-15-2005 06:45 PM
referencing a file - newbie question FastOwl MEPIS 4 07-05-2005 03:35 PM
Newbie question on writing CDs and listening mp3 songs. nasingh Linux - Software 1 04-11-2004 07:19 PM
newbie file backup question samiam Linux - General 2 11-14-2001 02:14 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:48 PM.

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