3

I want to monitor a unix(Solaris 10) directory and if there is any new file I want to copy it immediately.

Tried: I have shown inotifywait and incron package in Linux for it but I don't know whether it is compatible for unix or not. How I can perform this task in Solaris 10.

Be noted that I have root privilege.

  • 1
    There'slsyncd which combines inotify (or, possibly, other mechanisms) with rsync, but I have no experience with it on Solaris. – Ulrich Schwarz Jan 28 '16 at 5:29
  • 2
    Once you identify any new file, how do you know the file is not just partially complete? How are you going to tell it's fully written? – Andrew Henle Jan 28 '16 at 10:56
-3

You may use while loop...

for (( ; ; ))
do
cp -f /source/*.txt /destination >> /dev/null
sleep 2
done    

Used /dev/null to avoid displaying errors.

  • waste of system resources – mikejonesey Oct 26 '16 at 23:07
4

You can use rsync linux utility. You need to specify source and destination,it works locally as well as remotely. Please check man rsync for more details. For solaris, you'll need to install it.

  • 1
    Does rsync monitor a directory? I've always run it as a cron job. – Chad Clark Jan 28 '16 at 5:49
  • @ChadClark: Yes it monitors directory/file for changes. – Chetna C Jan 28 '16 at 13:02
  • rsync linux utility.? On a Solaris system? – Andrew Henle Jan 28 '16 at 13:55
  • @AndrewHenle: Please read full answer, I have mentioned to install it explicitly. – Chetna C Jan 29 '16 at 11:51
2

You could try Solaris File Events Notification. One approach shown here. Requires at least Solaris v11 though.

0

We had good experience with fswatch. From the README:

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.