- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- File Monitoring
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-09-2004 10:12 PM
05-09-2004 10:12 PM
File Monitoring
Can anyone recommend a good way to have a perl or shell script that constantly monitors for the creation of new files and launches another process?
I'm thinking of using perl or shell, so that I can easily modify the code without recompiling if I need to add more files to be monitored.
Thanks!
Cheers,
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2004 10:29 PM
05-09-2004 10:29 PM
Re: File Monitoring
Anyway, if you have a list of a few files you want to check for their creation, it's quite simple.
while true
do
for files in `cat list_of_files`
do
[ -r $files ] && {
# do stuff because this file exists
}
done
sleep 60
done
list_of_files contains the full path name of files to check.
I can't help thinking that you are trying to achieve something that could probably be done a better way. Could you give a little more detail as to what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2004 10:41 PM
05-09-2004 10:41 PM
Re: File Monitoring
Many thanks for your response. I am actually looking at creating a process that monitors for the creation of a set of files.
Once any one of these files are created, I need to start off another process to start processing the file.
Hope that gives a clear enough picture of what I want to do.
Cheers,
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2004 10:51 PM
05-09-2004 10:51 PM
Re: File Monitoring
For example, assuming these files arrive via ftp, I'd rather get the initiating machine to ftp the file then rexec/ssh/mail the receiving machine to start off the processing.
If the file names are known in advance, it might even be possible to have the names created as named pipes and then have something waiting on these files. This would be the best solution if ftp doesn't walk all over files that exist. Never tried it myself.
However, if we have no choice, a usual approach is to just make sure all files arrive in one directory and regualrly scan it for new files with "ls". It's a bit dull but it's simple.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2004 10:56 PM
05-09-2004 10:56 PM
Re: File Monitoring
why you don't use cron jobs in SAM?
SAM area - Process management - Scheduled cron jobs
You can use shell - for example delete core files:
find . -type f -name core -exec rm {} \;
Instead of rm you can do anything behind -exec
In SAM you configure how often this cron shall run.
It works for simple monitoring and you can also edit the cron jobs file manually to add more files.
Regards
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2004 11:06 PM
05-09-2004 11:06 PM
Re: File Monitoring
for the syntax check /var/spool/cron/crontab.root (for me under HP-UX 10.20)
To modify cron jobs:
/var/spool/cron/crontabs/root
Regards
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2004 02:11 AM
05-11-2004 02:11 AM
Re: File Monitoring
Thanks for the replies. I thought about using cron, but I actually need to be able to see if the process is running when I run top or ps -ef (which is why I thought about perhaps using perl).
I've tried the shell script, but I don't actually see the script that I launched. I just see the sleep. Is there anyway to have the name of the script show up during a top or ps?
Cheers,
Ben