Solaris: New files in a directory for longer than 1h
Hi guys,
I have an interesting problem. I have looked on the forums for simular solutions but i need a differnt approach.
On an evening i have files that are created and sit in a directory, then someone will send these files on. Sometimes they forget.....
I am trying to create something that will monitor the directory for new files but the files have been there for more than an hour and alerting. I have the alerting in place, but i can't get my brain to think of a good solution.
As it is a solaris system that i can't install any packages on.... i am taking an approach of:
creating a date stamp of an hour ago
touching a file with that date stamp then doing a find and showing all files created after my touched file
now this shows all files created after the the touched files datestamp(1hour ago) but also shows files created 1 min ago (i dont want it to alert these files as they just turned up) I could run via cron every 15 mins or so.
Am i complicating things? is there a better approach? Any suggestions would be great and what would be the best idea to get it to just show the files that have turned up and not sent after an hour?
Last edited by Franklin52; 03-21-2014 at 10:29 AM..
Reason: Please use code tags
I'm sorry to hear that, the 'find' in your OS must frustrated you..
Are you able to touch some file in the directory that you are monitoring ?
If so, you could run your script via cron every hour.
every time you run this script, you touch a mark file in that directory,
when you run this script every the next time, use
Code:
ls -t|sed '/your_mark_file_name/,$d'
This is the best method that I get now~.
This User Gave Thanks to Lucas_0418 For This Post:
I think i may need to do something like this, i was hoping not to put specific file names as i have 4 systems and they all have diff file names plus i would need to modify for new files. If i took this appraoch i may as well automate and send the files too. This Script could get a whole lot bigger lol
This thread is confusing. There is a simple way to find files of a given "age".
The basic idea is:
Code:
touch -t [min allowable time in past] dummy1 # youngest filetime to find
touch -t [ max allowable time int the past ] dummy2 # oldest filetime to find
find . -type f \( ! -newer dummy1 -a -newer dummy2 \)
Bracket around some time requirement. You can find all files 1 hour and older, say up to 5 days. This seems to be what you want.
Except the way the problem is stated the answer is not clear. At least to me.
Hah, also you could remove the previous mark file and touch a new one with the same name in the end of your script, you just need to choose a specific file name for every system~
Given a directory containing say a few thousand files,
please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents.
func(a_directory_name) output -> {“matches”: , ... ]}
e.g. func(“/home/my/files”) where the directory... (7 Replies)
Hi all,
i have a folder, with tons of files containing as following,
on /my/folder/jobs/
some_name_2016-01-17-22-38-58_some name_0_0.zip.done
some_name_2016-01-17-22-40-30_some name_0_0.zip.done
some_name_2016-01-17-22-48-50_some name_0_0.zip.done
and these can be lots of similar files,... (6 Replies)
i have a vmware workstation with solaris 10 installed on this.
i copying 2 gb data via samba from windows to this vmware workstation.
copy speed is 24 kb/sec.
how i can speed up this copy process ? (7 Replies)
I have a directory on a Solaris box that has 58 files written to it every 15min. They have a non standard date as part of the file name but always have another name with it. I need to check that directory for files created within the last 15min and then port the results to a log file. There are... (5 Replies)
Hi all,
Hello everyone, my first post here :). I tried to search the forum but I didn't find exactly what I was looking for...
I need to zip/tar files across entire filesystem which are more 3+ years old but leave folder structure intact. If the script locates tar/zip files they are more... (1 Reply)
This is a fairly complex issue. I do not have a lot of knowledge on X11. But here are the things.
I am running a program called Synergy off a Solaris server. The server sits in a remote network and can be accessed via NAT. Using Putty, I will enable X11 forwarding and launch Synergy via Putty.... (0 Replies)
Came in tonight, and some people started getting this error message
note: users were getting this error in IE6 and in firefox, pages seemed to process fine in Chrome. :confused:
anyway...
So I decided to restart the MySQL service, now it will not restart. First tried:
root@bender:/>... (2 Replies)
I have been using logrotate for quite awhile now. Most logs are rotated daily, using /etc/cron.daily. I noticed that the logs in question have not been rotated since April 6, but daily up to that point.
I have logrotate in /etc/cron.daily. The basic command is:
/usr/sbin/logrotate... (1 Reply)
hello:
I am a somewhat experienced unix user, but brand new to this forum. I am encountering a strange new problem.
I have a shell script called foo.ksh it has been running for years (literally) on my Sun (Solaris 8) machine.
Recently we put a version of samba on this machine to... (3 Replies)