- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting help
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
06-21-2004 07:04 AM
06-21-2004 07:04 AM
Scripting help
My thought was since I find the file by it's name, maybe I could somehow check it's creation date and time to make sure it's at least five minutes old. That way I would know the process is finished writing to it .(since the time and date are constantly updated as the application writes to the file)
The file finishes at various times each day, bit it needs to be ftp'd to it's destination as soon as it's finished.
I have a cron job at seven each morning that starts looking for the file and if it's ready it needs to be ftp'd. So if the script can check it's time and then maybe do an "at" command to check again in five minutes if the file isn't at least five minutes old (and therefore finished).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:10 AM
06-21-2004 07:10 AM
Re: Scripting help
diff orig.file lastest.file
Then continue to compare the file until the output is null then you can ftp it...
Should be a loop to check every N interval maybe a sleep command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:12 AM
06-21-2004 07:12 AM
Re: Scripting help
second way is to send a second file after the first one. if the second file is there the first one is finished.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:13 AM
06-21-2004 07:13 AM
Re: Scripting help
You could use the 'fuser' command to see if a process has the file open, and start the ftp when it doesn't. The only trick is that you have to be root to run 'fuser'.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:13 AM
06-21-2004 07:13 AM
Re: Scripting help
Get lsof tool and check if it is being used by any process? If not ftp it.
You can also use fuser for this.
fuser -u file_name
Man fuser. Get laos tool from HP porting center.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:15 AM
06-21-2004 07:15 AM
Re: Scripting help
See the attached fileage.pl script and invoke it as fileage.pl -u for full usage.
For your specific question:
TESTFILE=myfile
fileage.pl -s 300 ${TESTFILE}
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "File ${TESTFILE} has not been modified in the last 300 seconds."
else
echo "File ${TESTFILE} has been modified within the last 300 seconds."
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 09:42 AM
06-21-2004 09:42 AM