LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-26-2005, 09:07 AM   #1
misterjingo
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/submitdshieldlogs.pl >>/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, 09: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
2>&1
standard error (2) is redirected to standard output (1)

>/dev/null
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, 11:04 AM   #3
misterjingo
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, 03:59 PM   #4
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
How about something like

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


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


All times are GMT -5. The time now is 08:35 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration