- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Trace on Crontab job.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2005 04:57 AM
03-31-2005 04:57 AM
Do some one have any script to monitor the cron job. Where you can see any modification in the crontab file. Means some one has added or removed the entries.
I am trying to do this way
#!/usr/bin/ksh
. ~/.profile
###############################################
#
#
###############################################
TO=harpreet_singh@ctl.creative.com
LOGDIR=/usr/local/bin/perf-monitor
SUBJ="New Entry Found in the Crontab"
LOGFILE="${LOGDIR}/crontab_`hostname`.`date +'%d%m%y'`"
#crontab -l > master_cron_list
crontab -l > $LOGFILE
diff master_cron_list $LOGFILE > diff.txt
(
cat << !
cat $LOGFILE/diff.txt
echo "Some changes has been made in Crontab"
date
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
Bcc : ${BCC}
!
) | /usr/lib/sendmail -f ora_sysadmin@ctl.creative.com ${TO} ${CC} $BCC
echo "No Problem"
------------
Here I can send the mail, but recipient’s name, subject is also missing.
How I can show the diff.txt file in email
How I can attach diff.txt file in email.
Regards, Harry
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2005 05:01 AM
03-31-2005 05:01 AM
Re: Trace on Crontab job.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2005 05:08 AM
03-31-2005 05:08 AM
Re: Trace on Crontab job.
Something like follows.
#!/usr/bin/ksh
file_to_watch=/var/spool/cron/crontab/user_name
cp ${file_to_watch} /some_location/.
new_file=/some_location/file_name
size=$(ll /var/spool/cron/crontab/user_name|awk '{print $5}')
new_size=$(ll /var/spool/cron/crontab/user_name|awk '{print $5}')
if [[ ${new_size} -gt ${size} ]]
then
changes=$(diff $file_to_watch $new_file)
echo $changes | mailx -s "Change in Cron" xxx@dd.com
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2005 05:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2005 07:07 AM
04-01-2005 07:07 AM
Re: Trace on Crontab job.
Thanks for the reply. I got the answer.
Regards
Harry.