LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-30-2008, 01:33 PM   #1
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Rep: Reputation: 38
How to run this script in Crontab


Am trying to run a script every minute which will run another script in it and the output of capsuled script will be appended to a file..

crontab -e

Code:
## Min Hour Day Month Week

    *    *   *    *     * ~/My_Scripts/auto.sh
auto.sh

Code:
Code:
#! /bin/bash

sh ~/My_Scripts/disk.sh >> ~/Baiglog.log

disk.sh

Code:
#! /bin/bash

clear

df -h | grep /dev/sda1 | awk '{print "Disk: Win C Drive    Size:" $2,"  Used:" $3,"     Available:",$4}'
df -h | grep /dev/sda5 | awk '{print "Disk: Win D Drive    Size:" $2,"  Used:" $3,"     Available:",$4}'
f -h |grep gvfs-fuse-daemon | awk '{print "Disk: Linux Drive    Size:"$2,"  Used:"$3,"    Available:",$4}'

My cornd service is running!!

Am trying to learn shell scripting these days...


Cheers!!!
 
Old 11-30-2008, 01:39 PM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
Are you saying these scripts dont run? Try putting in full path to all scripts and executables because cron doesnt usually know environment and other variables like ~
 
Old 11-30-2008, 02:34 PM   #3
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Original Poster
Rep: Reputation: 38
All right, that was "~"problem.. now am done.. its doing what I wanted..

Now second thing,

How to mail this log to my email address?

would I have to install any packages to get this done?

Cheers!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run crontab in shell script panselva Linux - General 3 05-08-2008 08:33 PM
script won't run in crontab(centos 5) ncsuapex Programming 2 03-09-2008 06:55 PM
Script run by crontab won't send email Braynid Linux - Newbie 1 12-21-2007 12:16 AM
Crontab -e doesnt run my script ! c0nsur Linux - General 4 08-03-2005 11:21 PM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM


All times are GMT -5. The time now is 03:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration