LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-10-2007, 07:31 PM   #1
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Rep: Reputation: 51
shell command script question....


All right, I am in the process of putting together a small command script to run my IP monitoring software app (iptraf) on my server at boot time. Basically I am wanting it to run in the background and log my traffic. The question I have, is I want to put the current date in the log's filename when it originally gets created. How would I accomplish this? I have seen with some commands that it usually consists of a percent sign followed by some letter (ex: %M) to do certain things similar to what I am wanting...is that basically what I need to do?
 
Old 04-10-2007, 08:34 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Review the date(1) manpages (FORMAT section). Example:
Code:
[hector@troy ~]$ FILENAME=mylog$(date +%Y%m%d).log
[hector@troy ~]$ echo $FILENAME
mylog20070410.log
 
Old 04-11-2007, 04:36 PM   #3
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
Awesome, thanks.

I was kinda figuring that's what I'd have to do but just thought I'd double check to be sure.
 
  


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
command with shell script sunlinux Programming 2 12-28-2006 11:36 PM
Executing a shell script command!! vishamr2000 Programming 4 08-15-2005 12:33 AM
Command in shell script Grassie Coetzee Linux - Software 1 03-13-2005 11:42 AM
command not found (My shell script) Swift&Smart Linux - Software 3 05-15-2004 11:14 PM
Shell script login command? chup Linux - General 3 08-24-2003 06:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:21 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
Open Source Consulting | Domain Registration