- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script Questions
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
11-20-2006 08:10 AM
11-20-2006 08:10 AM
jumping quite a bit at various times of the day. I want to try to pinpoint as much as possible what is causing this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 08:21 AM
11-20-2006 08:21 AM
Solution# touch -amt 11200001 /tmp/myref
# find /path -xdev -type f -newer /tmp/myref
The above will create a reference point beginning at November 20 at 0001. The 'find' will look for *files* in the '/path' that have been created or modified since then. The '-xdev' option prevents crossing mountpoints -- most useful if you want to search the root ('/' directory.
See the manpages for 'find' for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 08:30 AM
11-20-2006 08:30 AM
Re: Script Questions
I would somehow have to make that reference point time be 2 or 3 hours prior to the time that I do the check. Is there a way to do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 08:49 AM
11-20-2006 08:49 AM
Re: Script Questions
By using date +%m%d%H%M you can get: 11201344
By breaking apart date, you can get just the %H field and subtract 3. And if negative, you can get the %d field and subtract 1 and add 24 to the %H field. You may need to use printf(1) to make sure each field is two digits.
And more checks for beginning of the month and year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 08:56 AM
11-20-2006 08:56 AM
Re: Script Questions
OK, let's create a tiny script that you can modify and 'cron':
# cat .findit
#!/usr/bin/sh
typeset REF=/tmp/myref
touch ${REF}
perl -e '$t=time()-(60*60*3);utime($t,$t,@ARGV)' ${REF}
find /path -xdev -type f -newer ${REF}
exit 0
...This script creates a "referenece" file named by ${REF}. A Perl snippet is used to set the file's modification and access time to some number of hours ago from the current time. I used 3-hours in the code. The reference file is then used in a 'find'.
If you want to run this automatically every
hours, make a crontab entry like:
0 0,3,6,9,12,15,18,21 * * * /home/andre/findit
This will run your script every thre hours beginning at midnight. See the manpages for 'crontab' for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 09:06 AM
11-20-2006 09:06 AM
Re: Script Questions
use an appropriate TZ variable for a changed timezone for this purpose:
Actual timezone: TZ=MET-1
Three hours before: TZ=XXX2 (-1 + 3)
Create a reference file via
touch -m -t $(TZ=XXX2 date +%m%d%H%M) /tmp/myref
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 09:06 AM
11-20-2006 09:06 AM
Re: Script Questions
Thanks as always
Andre'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 01:49 PM
11-20-2006 01:49 PM
Re: Script Questions
If you are comfortabel trying perl, then check out its '-M ' file function:
-M Script start time minus file modification time, in days.
Add to that a 'glob' and you might be in business:
perl -e "while (<*.txt>) { print "$_\n" if 3/24 > -M }"
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 04:02 PM
11-20-2006 04:02 PM
Re: Script Questions
you can also use the "at" command inside your script to re-schedule itself after it has executed.
e.g.
echo "
see "man at" for more details.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2006 05:13 PM
11-20-2006 05:13 PM
Re: Script Questions
echo "
A better way would to just use the -f option and give a relative time:
at -f /path-to/your-script.ksh +2 hours > /dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 01:21 AM
11-22-2006 01:21 AM
Re: Script Questions
Thanks a bunch.
Andre'