CURTIME=$(date '+%s') LOG=/home/apache_logs.txt FILETIME1=$(stat $LOG -c %Y) TIMEDIFF1=$(expr $CURTIME - $FILETIME1)
I created this script in Ubuntu and it works fine there but on SunOS, (Generic_150400-64 sun4v sparc sun4v), it is not working.
This script is to check if logs are updating and do ( If else ) depending on the output of seconds in TIMEDIFF1 .
If else will perform stuff like, if logs are updated 15 mins ago do this, if 30 mins ago do that... and so on.
So time in seconds as an output is important for if else statement to run efficiently.
so I am trying to determine how old a file is (how long ago it was modified / updated) in SECONDS. and I need time in seconds.