How do I schedule the df command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I schedule the df command
# 1  
Old 01-30-2009
How do I schedule the df command

Talk about making me feel welcome. Is nice! Smilie

OK, to the question. I work in the IT dept for a Financial Investment Management company. I've written a VB script to check various systems and the script works well but I've been asked to add an additional check on a UNIX system (specifically a NetApp SAN which is used from our VMWare ESX environment) which is where this forum comes in to the rescue.

I've established the 'df -h' command will produce the output I need, albeit with some extra columns and some extra lines, but I need to work out how to get the data somewhere from which our Windows clients can see it and on a schedule.

So
  1. How do I strip out lines that include ".snapshot" (I could do this afterwards with the VB script so not a big deal)?
  2. How do I schedule the df command to run at, say, 06:00 and 16:00 every day?
  3. How can I make the report available on the Windows network? Would this be via a CIFS share (and if so, how do I create it)?
Just to clarify point 1, here's an example of the output:

Code:
Filesystem     total    used   avail   capacity     Mounted on
/vol/TestVol0/ 239GB   216GB    23GB        90%  /vol/TestVol0/
/vol/TestVol0/.snapshot 0MB 8023MB 0MB ---% /vol/TestVol0/.snapshot
/vol/vol0/      16GB   607MB    15GB         4%  /vol/vol0/
/vol/vol0/.snapshot 4096MB 11MB 4084MB 0% /vol/vol0/.snapshot

...which just looks a mess. It would look much neater (and be easier to query) if it was like this:
Code:
Filesystem      total    used   avail   capacity       Mounted on
/vol/TestVol0/  239GB   216GB    23GB        90%   /vol/TestVol0/
/vol/vol0/       16GB   607MB    15GB         4%       /vol/vol0/

...but not essential (note that doubled-up spaces have been stripped out by this interface so it still doesn't look as neat as it should here. Oh well).

TIA!

JJ

Last edited by DukeNuke2; 01-30-2009 at 11:24 AM.. Reason: code tags added...
# 2  
Old 01-30-2009
Quote:
Originally Posted by jpjeffery

I've established the 'df -h' command will produce the output I need

So
  1. How do I strip out lines that include ".snapshot" (I could do this afterwards with the VB script so not a big deal)?
  2. How do I schedule the df command to run at, say, 06:00 and 16:00 every day?
  3. How can I make the report available on the Windows network? Would this be via a CIFS share (and if so, how do I create it)?
Depends which OS your running, but:

1) grep -v (ie: df -h | grep -v snapshot) - do a "man grep" - perhaps redirect output to a file
2) Take a look at the man pages for cron
3) easy way would be to ftp the file to the local network - you could also cron an ftp process to transfer the file for you at a regular time each day
# 3  
Old 01-30-2009
Thank you.

I've found that the command grep isn't actually recognised, which is odd.

Is there a command you can run to establish exactly which OS is running?

JJ
# 4  
Old 01-30-2009
Quote:
Originally Posted by jpjeffery
Is there a command you can run to establish exactly which OS is running?
you can try "uname -a"... but if you are on a netapp filer it should be some kind of BSD derivat?!
# 5  
Old 01-30-2009
the rightmost column of 'uname -a' usually gives it up for the OS. what shell are you running under though? grep should be available on most systems...and shells.

Otherwise, check out one of the UWIN or Cygwin apps which would let you run the whole shebang from within Windows. Both even provide for ssh clients that can tap into your UNIX system's ssh service as well. It provides a full ksh93 option for those of us cursed with bills and gates...
# 6  
Old 01-30-2009
Quote:
Originally Posted by DukeNuke2
you can try "uname -a"... but if you are on a netapp filer it should be some kind of BSD derivat?!
Good call. 'uname' is also not recognised. When I log on with telnet it tells me this (about to try the CODE tags, thanks for that in the earlier post, BTW)
Code:
Data ONTAP

Not sure where to go from here as it seems to me if the system doesn't recognise basic commands like uname and grep what chance have I got of setting it up to FTP or working with CRON to schedule anything?

I should say that so far NetApp support haven't exactly showered themselves in glory hence I've come here and already got further!
# 7  
Old 01-30-2009
i think the netapp os (ONTAP) is stripped from some unix basic functions... so it would be best to do the commands from remote with "ssh" which i think should be onboard with ONTAP. just use you admin workstation (which is hopefully not windows!) and work with ssh commands like this:

Code:
ssh -l username df -h | grep -v snapshot

if this works, we can look on to solve the other problems...

btw. if you run windows on your admin station you can maybe download a virtual desktop system like virtualbox and run a linux or unix on your workstation. this helps in two ways:
you can try commands on your workstation
and
you can use the tools from unix/linux to work on the output of the netapp mashine

hth,
DN2
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to schedule crontab?

Hi All, How to schedule crontab on all day except sunday and monday means from tuesday to saturday at 06:00AM. (3 Replies)
Discussion started by: Riverstone
3 Replies

2. HP-UX

Help with cron schedule

Hope you can help with a queuy i have. Server OS is HP-UX my cron runs like this: * * * * * /test/scripts/1_min_jobs.sh 1>/dev/null 2>/dev/null 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /test/scripts/jobs_5mins.sh 1>/dev/null 2>/dev/null 0,15,30,45 * * * *... (10 Replies)
Discussion started by: davexxash
10 Replies

3. UNIX for Dummies Questions & Answers

Schedule the Script

I have wriiten one script to get some results from log files. Daily I have to run the script using the below command to get the output. What I need is, Can I schedule the Script to execute once every day at a particular Time and get the output by mail automatically? I heard about 'cron job' . .... (3 Replies)
Discussion started by: Padmanabhan
3 Replies

4. Shell Programming and Scripting

Crontab schedule

Hi, I have a script which will query the DB and added to crontab at 1,2,6,7 AM everyday and sends a email if count is 0. Now the problem is, if crontab is disabled it doesn't sends a mail. Please tell me how can I handle this situation in the script. (2 Replies)
Discussion started by: sandy1028
2 Replies

5. Shell Programming and Scripting

Schedule without cron

Hi, How to write the recursive function. I have a script, #!/usr/bin/ksh ## name=$1 outputfile='output.log' sqlplus -s > ${outputfile} <<__END__ ${USER}/${PASS}@${DB} WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK WHENEVER OSERROR EXIT FAILURE ROLLBACK SET ECHO ON SET SERVEROUTPUT... (3 Replies)
Discussion started by: sandy1028
3 Replies

6. UNIX for Advanced & Expert Users

How to schedule "topas" command in crontab

Hi, Grateful if you could advise how to schedule the AIX "topas" command in crontab? Below script works fine at shell prompt. But it does not run via crontab at an AIX Server. Script: topas_run.sh export top_file=/oracle/rman_scripts/"topas_run"_`date '+%m_%d_%y_%H_%M_%S'`".txt" echo >>... (7 Replies)
Discussion started by: schandrakar1
7 Replies

7. Shell Programming and Scripting

schedule tasks

As far as I know Crontab is the utulity to schedule tasks to run at specific times.Is there any utility to perform the same task (4 Replies)
Discussion started by: tjay83
4 Replies

8. UNIX for Dummies Questions & Answers

Crontab schedule

I have the following crontab entry. 0,30 00-16 * * * This job runs every 30 minutes between the hours of 12:00AM and 4:00PM. How can I have it stop at 4:30PM instead? Thank you, David (3 Replies)
Discussion started by: dkranes
3 Replies

9. UNIX for Advanced & Expert Users

command to schedule a unix script in tidal' scheduler

hi i am needed to use tidal's scheduler to schedule unix scripts available on server A. while creating a job to be scheduled, it has an option called command which will take a path of the file. i have seen several examples in the following way e:\tidal\bin\sleep.exe here i did not understand two... (0 Replies)
Discussion started by: balireddy_77
0 Replies

10. UNIX for Dummies Questions & Answers

How do you schedule a command to run at 4:00 every morning?

How do you schedule a command to run at 4:00 every morning? (1 Reply)
Discussion started by: JosephGerard
1 Replies
Login or Register to Ask a Question