- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- datecalc -utility in unix
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
Discussions
Discussions
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
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
07-02-2012 12:54 PM - edited 07-02-2012 12:54 PM
07-02-2012 12:54 PM - edited 07-02-2012 12:54 PM
datecalc -utility in unix
Hi Experts,
We have a script from hp-ux and needs to be migrate to linux (redhat )platform,
The existing script in hp-ux is using maestro job scheduler , and using an utility called datecalc ,
However on linux side it will not be used maestro application , so the datecalc program is not there .
Here is from the hp-ux system: The line in the batch script looks like:
####
export TODAY=`date "+%Y%m%d.%H%M"`
...
export datecalc=`/opt/maes100/maestro/bin/datecalc today -1 days pic yyyy.mm.dd`
...
###
Question: How to migrate this portion, What kind of utility or command need to use to convert similar date format in linux. Is there anything available to convert date in linux like datecalc utility.
Thanks in advance,
- Tags:
- caljd
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2012 12:59 PM
07-02-2012 12:59 PM
Re: datecalc -utility in unix
you are going to need to "roll your own".
i suggest the perl module date::calc -- works great
http://search.cpan.org/~stbey/Date-Calc-6.3/lib/Date/Calc.pod
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2012 01:08 PM
07-02-2012 01:08 PM
Re: datecalc - utility in Linux
Or look at Clay's perl caljd:
http://h30499.www3.hp.com/t5/tag/caljd/tg-p/category-id/itrc-117
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2012 02:03 PM
07-02-2012 02:03 PM
Re: datecalc - utility in Linux
Thanks both,
Dennis,
I tried to use the caljd.sh in linux, I changed the shell in the first line of the script from /usr/bin/sh to /bin/bash , but getting error , in getting the YESTARDAY_DATE :
sh-3.2$ YESTERDAY_DATE=$(caljd -s -y $(caljd -p 1))
./caljd: line 116: typeset: -Z: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
./caljd: line 118: typeset: -Z: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
./caljd: line 124: typeset: -Z: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
sh-3.2$
any suggesion.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2012 02:10 PM
07-02-2012 02:10 PM
Re: datecalc - utility in Linux
>I tried to use the caljd.sh in Linux,
Try the perl version as it should be more portable.
I also ran into the lack of -Z in typeset when I ported a script to bash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2012 02:44 PM
07-02-2012 02:44 PM
Re: datecalc - utility in Linux
Thanks, Since it is linux , there are lot of flexibility for date command , and I found a good one.
Very simple: $ date -d yesterday
$ date -d yesterday
Sun Jul 1 15:43:29 MDT 2012
# Todays Date:
$ date "+%Y.%m.%d"
2012.07.02
# Yesterdays Date:
$ date "+%Y.%m.%d" -d yesterday
2012.07.01
its so cool...