Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Linux VPS Support

Notices

Reply
 
Thread Tools
  #1  
Old 12-20-2011, 11:52 AM
bcaa8ra bcaa8ra is offline
Junior Croc
 
Join Date: Aug 2008
Location: Sarasota, FL
Posts: 106
Question Help with shell script

I am very new to linux, I am trying to write some monitoring scripts and email results.

So far I have this script written:
#!/bin/bash
df -h > /tmp/mail_report.log
free -m >> /tmp/mail_report.log
df -i >> /tmp/mail_report.log
mail -s “disk and RAM report” bernie@makoweb.com < /tmp/mail_report.log


My 2 questions are..
#1 - where would I put this script?
#2 - how would I schedule a cron job to run the script daily?

Thanks for any help provided!
__________________
Bernie Clark
MAKO Web Sales LLC
Sarasota Florida’s Only Certified Paypal Developer!

Sarasota: 941-870-2271
Toll Free: 877-625-6932
http://www.makoweb.com
Reply With Quote
  #2  
Old 12-20-2011, 12:02 PM
freeman's Avatar
freeman freeman is offline
Swamp Croc
 
Join Date: Jan 2006
Location: Montreal, QC, Canada
Posts: 308
Default Re: Help with shell script

Quote:
Originally Posted by bcaa8ra View Post
I am very new to linux, I am trying to write some monitoring scripts and email results.

So far I have this script written:
#!/bin/bash
df -h > /tmp/mail_report.log
free -m >> /tmp/mail_report.log
df -i >> /tmp/mail_report.log
mail -s “disk and RAM report” bernie@makoweb.com < /tmp/mail_report.log


My 2 questions are..
#1 - where would I put this script?
#2 - how would I schedule a cron job to run the script daily?

Thanks for any help provided!
Before using your script do:

PHP Code:
chmod +x script_name.sh 
#1 - where would I put this script?
in any place one example will be /opt
#2 - how would I schedule a cron job to run the script daily?
crontab -e # to edit
insert a new line:
0 0 * * * /opt/file_to run

and save.


To see what is running:

tail -f /var/log/cron


or copy file into those directories:

/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly

Read more here:
http://www.centos.org/docs/5/html/5....nfiguring.html



Regards,
George B.
__________________
Beneficium accipere, libertatem est vendere

Last edited by freeman; 12-22-2011 at 12:02 PM.
Reply With Quote
  #3  
Old 12-20-2011, 01:06 PM
bcaa8ra bcaa8ra is offline
Junior Croc
 
Join Date: Aug 2008
Location: Sarasota, FL
Posts: 106
Default Re: Help with shell script

Thanks George, i checked out your website and will contacting for some work I want done.
Bernie
__________________
Bernie Clark
MAKO Web Sales LLC
Sarasota Florida’s Only Certified Paypal Developer!

Sarasota: 941-870-2271
Toll Free: 877-625-6932
http://www.makoweb.com
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell access jwhite Shared Hosting Support 2 01-14-2009 02:43 PM
Shell access rfay Suggestions 7 08-18-2004 02:36 PM

All times are GMT -5. The time now is 04:07 AM.