- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script question
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
10-25-2001 09:13 AM
10-25-2001 09:13 AM
again i need your help. i am currently working on some scripts, which should log with timestamps. i.e.:
-(snip)----------------
#!/bin/sh
PATH=/usr/bin:/usr/sbin
TIMESTAMP=`date +"%d.%m.%E %H:%M:%S"
echo "NOTE: $0 START AT ${TIMESTAMP}"
echo "NOTE: $0 END AT ${TIMESTAMP}"
-(snip)----------------
The output i want to see are different times between start of the script and end, like:
NOTE: <script> START AT 25.10.2001 19:09:03
NOTE: <script> END AT 25.10.2001 19:11:31
My problem is that the timestamps are absolutely equal. What am i doing wrong ?
TIA, RGDS, Holger
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:19 AM
10-25-2001 09:19 AM
Re: script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:22 AM
10-25-2001 09:22 AM
Re: script question
#!/bin/sh
PATH=/usr/bin:/usr/sbin
TIMESTAMP=`date +"%d.%m.%E %H:%M:%S"
TIMESTAMP1=`date +"%d.%m.%E %H:%M:%S"
echo "NOTE: $0 START AT ${TIMESTAMP}"
echo "NOTE: $0 END AT ${TIMESTAMP1}"
That's what I would do, but there are a million ways to do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:22 AM
10-25-2001 09:22 AM
Re: script question
You are using the displaying the valu of TIMESTAMP,
calculate the value of timestamp after your commands
Eg:
TIMESTAMP=`date +"%d.%m.%E %H:%M:%S"
echo "NOTE: $0 START AT ${TIMESTAMP}"
TIMESTAMP=`date +"%d.%m.%E %H:%M:%S"
echo "NOTE: $0 END AT ${TIMESTAMP}"
This should fix it
-Regards
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:26 AM
10-25-2001 09:26 AM
Re: script question
echo NOTE: $0 START AT `date +"%d.%m.%E %H:%M:%S"`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:27 AM
10-25-2001 09:27 AM
Re: script question
how long something takes to run.
(eg) timex ls
Eileen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 09:33 AM
10-25-2001 09:33 AM
Re: script question
easy fix
Change the `` to '' to assign TIMESTAME to the command.
TIMESTAMP='date +"%d.%m.%E %H:%M:%S"'
Then in your echo command excute TIMESTAMP like:
echo "start `$TIMESTAMP`"
echo "end `$TIMESTAMP`"
Hope this helps.
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 10:04 AM
10-25-2001 10:04 AM
Re: script question
ONE problem, MANY solutions.
Craig, your suggestion sounds good, i tried it but unfortunately it didn't work. HMMMM, strange...
Eileen, attractive command. I will check it out again! Thanx everybody.
RGDS, Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 12:25 PM
10-25-2001 12:25 PM
Re: script question
I will have to look at my logic. I may have tried to answer the question before my second cup of coffee!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2001 12:39 PM
10-25-2001 12:39 PM