- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need Date Stamp in Cron
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 12:39 AM
тАО01-04-2005 12:39 AM
#0,15,30,45 * * * * /home/sysadmin/chifmsystmstats.sh >/home/sysadmin/chifm.html 2>/dev/null
What I need to do is add a date stamp to chifm.html. Is there a way to do this in cron? I tried some date logic but the cron file didn't like it. I tried
Date=`date +%b%d`
chifm.${Date}.html
Any help would be appreciated.
Thanks
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 12:56 AM
тАО01-04-2005 12:56 AM
Re: Need Date Stamp in Cron
(cron entry)
0,15,30,45 * * * * /home/sysadmin/chifmsystmstats.sh 2>/dev/null
(Inside the script /home/sysadmin/chifmsystmstats.sh)
DATE==`date +%b%d`
# Output commands
echo "A B C D E" > >/home/sysadmin/chifm.${DATE}.html
(end comments)
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 12:59 AM
тАО01-04-2005 12:59 AM
SolutionWhy not simply solving that by a script which calls chifmsystmstats.sh instead of redirecting the output to chifm.html from cron?
In new script:
load all you need
Date=`date +%b%d`
/home/sysadmin/chifmsystmstats.sh >chifm.${Date}.html
etc...
and in crontab
#0,15,30,45 * * * * /home/sysadmin/newscript >>/tmp/newscript.log 2>&1
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 01:01 AM
тАО01-04-2005 01:01 AM
Re: Need Date Stamp in Cron
your_script
#! /bin/sh
Date=`date +%b%d`
chifm.${Date}.html
/home/sysadmin/chifmsystmstats.sh > /home/sysadmin/chifm.$(Date).html 2>/dev/null
#0,15,30,45 * * * * your_script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 01:13 AM
тАО01-04-2005 01:13 AM
Re: Need Date Stamp in Cron
/home/sysadmin/chifmsystmstats.sh
dman=$(date)
echo $dman >> /home/sysadmin/chifrm.html
Insert the code whereever it formats best.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 02:42 AM
тАО01-04-2005 02:42 AM
Re: Need Date Stamp in Cron
you can create "main_script.sh" that will contain following
Date=`date +%b%d`
chifm.${Date}.html
/home/sysadmin/chifmsystmstats.sh >
/home/sysadmin/chifm.${Date}.html 2> /dev/null
then
0,15,30,45 * * * * /home/sysadmin/main_script.sh
it should work
rgds Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 02:51 AM
тАО01-04-2005 02:51 AM
Re: Need Date Stamp in Cron
0,15,30,45 * * * * /home/sysadmin/chifmsystmstats.sh >/home/sysadmin/chifm.$(/usr/bin/date +%b%d).html 2>/dev/null
(everything on the same line, of course)
regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2005 02:59 AM
тАО01-04-2005 02:59 AM
Re: Need Date Stamp in Cron
Thanks to all!!