- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Crontab Modification Script
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
07-08-2003 05:32 AM
07-08-2003 05:32 AM
crontab -l > /usr/local/apache/htdocs/harris/crontabtext
diff /usr/local/apache/htdocs/harris/crontabtext /usr/local/apache/htdocs/harris/crontabtext.backup > /tmp/crontab_changes
if [ -s /tmp/crontab_changes ] #send mail if file is not empty
then
echo "The Crontab has been changed" | sendmail harriskd@matcom.usmc.mil
cp /usr/local/apache/htdocs/harris/crontabtext /usr/local/apache/htdocs/harris/crontabtext.backup
rm /tmp/crontab_changes
fi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2003 05:44 AM
07-08-2003 05:44 AM
Solution#!bin/bash
#
in order to let your system know it has to work with shell scripting.
Try adding a line after fi :
what if nothing changes ?
I suggest 'touch test.txt' to debug,
then 'exit 0' for final version.
hth
J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2003 06:06 AM
07-08-2003 06:06 AM
Re: Crontab Modification Script
Thanks. That seemed to help. I finally got this script to at least run and the files got created when i would change the crontab. The only thing left not working is it sending email to me via sendmail. Is my sendmail line correct? It looks right to me. Thanks for your help. Pts have been rewarded!
Kyle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2003 06:13 AM
07-08-2003 06:13 AM
Re: Crontab Modification Script
hth
Claudio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2003 06:42 AM
07-08-2003 06:42 AM
Re: Crontab Modification Script
tks fr your points !
RE sendmail issue, your line is correct, except that message should follow endmail command :
try /usr/sbin/sendmail harriskd@matcom.usmc.mil <"The Crontab has been changed"
It should work.
Claudio suggestion would also work, as mail command works very well in the pipe option.
Glad your script works !
J