Link to home
Start Free TrialLog in
Avatar of vikrant_kpr
vikrant_kpr

asked on

Need an hook to the Solaris file system

Hi Friends

  I am looking for  some hook to the Solaris file system at the OS level which will generate a notification to my program whenever a file is created or deleted. The notification needs to contain the filename, filepath and the type of filechange (i.e. Creation/deletion)

Any suggestions ?

Regards
Manish

Avatar of CadburyKat
CadburyKat

Hello,

You may need to get a little creative here.
-----------------SNIP---------------------------------
#!/bin/ksh

if [ -f /tmp/out.dat ]
then
   mv out.dat out.dat.old
fi

find /var/opt | sort > /tmp/out.dat

#This will report the differences

diff /tmp/out.dat /tmp/out.dat.old

#if you want to compare and contrast dates you will need to do something like this

if [ -f /tmp/ls.out.dat ]
then
   mv /tmp/ls.out.dat  /tmp/ls.out.dat.old
   for file in `cat /tmp/out.dat`
   do
      ls -al ${file} > /tmp/ls.out.dat
   done
fi

for file in `cat /tmp/out.dat`
do
   ls -al ${file} > /tmp/ls.out.dat
done
OOOPS.  Use this working script:


#!/bin/ksh

touch out.dat.old

if [ -f /tmp/out.dat ]
then
   mv out.dat out.dat.old
fi


#######################################
#EDIT the directory of interest here
#######################################
find /etc/patch | sort > /tmp/out.dat

#This will report the differences
echo "#######################################"
echo "These are the files that are different"
echo "#######################################"
diff /tmp/out.dat /tmp/out.dat.old

#
#
#
#if you want to compare and contrast dates you will need to do something like this

if [ ! -f /tmp/ls.out.dat.old ]
then
   touch /tmp/ls.out.dat.old
fi

if [ -f /tmp/ls.out.dat ]
then
   mv /tmp/ls.out.dat  /tmp/ls.out.dat.old
fi

for file in `cat /tmp/out.dat`
do
   if [ ! -d ${file} ]
   then
      false
   else
      ls -al ${file} >> /tmp/ls.out.dat
   fi
done


#This will report the differences
echo "#######################################"
echo "These are the files that are different"
echo "#######################################"
diff /tmp/ls.out.dat /tmp/ls.out.dat.old
have a look at this thread:
https://www.experts-exchange.com/questions/21806194/Monitor-file-system-for-new-files.html

famd for example should be available for Solaris, too AFAIK.

HTH,
-XoF-
Blastwave has fam for Solaris:

http://www.blastwave.org/packages.php/fam

Haven't used it so can't say how well it works.
ASKER CERTIFIED SOLUTION
Avatar of XoF
XoF

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial