nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Need help with script

This is a discussion on Need help with script within the Shell scripting forums, part of the Development/Scripting category; I am currently working on setting up a shell script to monitor NAS backup disk space for your account. I ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 13-04-2009, 06:56 AM
Junior Member
User
 
Join Date: Apr 2009
OS: Debian
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Zebrabiology is on a distinguished road
Default Need help with script

I am currently working on setting up a shell script to monitor NAS backup disk space for your account. I am completely new to scripting and linux itself so bare with me lol.

NAS Backup Server Disk Monitoring Shell Script
LIMIT="17" - is it suppose to be how much space left?
GETNASIP=$(host ${NASIP} | awk '{ print $4}') - Does host get replace
by the IP address? Or what is the purpose of this line?

Last edited by Zebrabiology; 13-04-2009 at 07:04 AM.
Reply With Quote
  #2 (permalink)  
Old 13-04-2009, 07:21 AM
Junior Member
User
 
Join Date: Apr 2009
OS: Debian
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Zebrabiology is on a distinguished road
Default

I also am confused with the following:

Do I choose between the two options or am I required to have both to make this script work. I can no longer find the edit button in the forums, so I am sorry that I am double posting.

# Failsafe[ ! -d ${NASMNTPOINT} ] && mkdir -p ${NASMNTPOINT}mount | grep //${GETNASIP}/${NASUSER}
or

# if not mounted, just mount nas[ $? -eq 0 ] && : || mount -t cifs //${NASIP}/${NASUSER} -o username=${NASUSER},password=${NASPASS} ${NASMNTPOINT}cd ${NASMNTPOINT}
???
Reply With Quote
  #3 (permalink)  
Old 13-04-2009, 04:07 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Quote:
Originally Posted by Zebrabiology View Post
LIMIT="17" - is it suppose to be how much space left?
Yes, this is warning level. If 17GB space is occupied it will send an email.

Quote:
Originally Posted by Zebrabiology View Post
GETNASIP=$(host ${NASIP} | awk '{ print $4}') - Does host get replace
by the IP address? Or what is the purpose of this line?
It will get nas server IP address i.e. it will convert nas.example.com to its IP address.

Quote:
Originally Posted by Zebrabiology View Post
Do I choose between the two options or am I required to have both to make this script work. I can no longer find the edit button in the forums, so I am sorry that I am double posting.
You only need to set the following:
NASUSER="Your-User-Name"
NASPASS="Your-Password"
NASIP="nas.yourcorp.com"
NASROOT="/username"
NASMNTPOINT="/mnt/nas"
EMAILID="admin@yourcorp.com"

Rest will work out automatically. There is no need to modify the rest of script untie and unless you have a specific needs.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #4 (permalink)  
Old 13-04-2009, 08:45 PM
Junior Member
User
 
Join Date: Apr 2009
OS: Debian
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Zebrabiology is on a distinguished road
Default

thank you for being so helpful.
Reply With Quote
  #5 (permalink)  
Old 14-04-2009, 01:13 AM
Junior Member
User
 
Join Date: Apr 2009
OS: Debian
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Zebrabiology is on a distinguished road
Default

I may of found an error in the script.
I modified the NASROOT=/home, but I noticed that this variable is not being used in the script. I might of found a place that it might be used which is when the cd ${NASMNTPOINT}. Am I right?
Reply With Quote
Reply

Tags
backup , linux , nas , shell scripting , unix


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT +5.5. The time now is 08:06 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38