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.

2
  • 1
    There'slsyncd which combines inotify (or, possibly, other mechanisms) with rsync, but I have no experience with it on Solaris. Jan 28, 2016 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? Jan 28, 2016 at 10:56

4 Answers 4

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.

4
  • 1
    Does rsync monitor a directory? I've always run it as a cron job.
    – Chad Clark
    Jan 28, 2016 at 5:49
  • @ChadClark: Yes it monitors directory/file for changes.
    – Chetna C
    Jan 28, 2016 at 13:02
  • rsync linux utility.? On a Solaris system? Jan 28, 2016 at 13:55
  • @AndrewHenle: Please read full answer, I have mentioned to install it explicitly.
    – Chetna C
    Jan 29, 2016 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,

-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.

1
  • waste of system resources Oct 26, 2016 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .