- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripts need hourly augment.
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
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
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
05-25-2006 10:26 PM
05-25-2006 10:26 PM
For example:- If I want to check 3 AM log details I execute the script like below:
./oom_moni.sh 3
I want to execute this every hour so Iam scheduling through cron job on hourly basis.
Problem is how can I pass hourly augument to my script.
Please advice in this matter
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 10:30 PM
05-25-2006 10:30 PM
Re: Scripts need hourly augment.
# date +'%H'
06
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 10:37 PM
05-25-2006 10:37 PM
Re: Scripts need hourly augment.
The problem now is
If Iam executing script at 4 AM I should give augument as 3. (Which means Before number I should give)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 11:19 PM
05-25-2006 11:19 PM
Re: Scripts need hourly augment.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 11:33 PM
05-25-2006 11:33 PM
Re: Scripts need hourly augment.
if you do have to run the script after 3:59 you could look into the TZ parameter.
In the UK:
$ date +'%Y%m%d%H%M'
200605261237
$ TZ=BST date +'%Y%m%d%H%M'
200605261137
or for your case:
$ date +'%H'
12
$ TZ=BST date +'%H'
11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 11:48 PM
05-25-2006 11:48 PM
Re: Scripts need hourly augment.
If you want to deduct an hour from your current runtime, I would use a Perl snippet like:
# perl -le '$t=(localtime(time()-3600)) [2];print $t'
Perl handles time/date in epoch seconds, so 3600 is the equivalent of one-hour.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2006 11:53 PM
05-25-2006 11:53 PM
Solutionif [ "$(date '+%H'|cut -c1) = "0" ];then
hour=$(date '+%H'|cut -c2)
else
hour=$(date '+%H')
fi
then call your script.
your_script ${hour}