Operating System - HP-UX
1837097 Members
2382 Online
110112 Solutions
New Discussion

logging script and sticky bit file

 
SOLVED
Go to solution
Ratzie
Super Advisor

logging script and sticky bit file

I have a script that runs by cron, the script starts by starting the log file...
exec 1>$BACKUP_LOG 2>&1

I then get this sent to me in the mail.

This script also runs 3 other scripts, I need to check if it has another user sticky bit applied, how do I do that?

If the sticky bit is not applied I need it to notify me by mail.
So I know it will envolve an if statement.

What I am doing now, is at the end of the script, I grep $BACKUP_LOG for certain words, and if it finds, it emails me.
I am just wondering if I am going about it right...
1 REPLY 1
Sridhar Bhaskarla
Honored Contributor
Solution

Re: logging script and sticky bit file

Hi,

Put a small piece of code in your script something like this.

your_script_lines..
...
SCRIPT=/mylocation/myscr.sh
ll -d $SCRIPT |awk '$1 ~ "s|t|S|T" {print $0}' |grep -q $SCRIPT
if [ $? = 0 ]
then
echo "$SCRIPT has sticky bit on it" >> $BACKUP_LOG
fi
..
..

While you grep for certain words, add sticky bit also to it and get it mailed.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try