Require Help for Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Require Help for Shell Script
# 8  
Old 01-31-2008
MySQL

Dear jagnikam,

./test1.sh: line 7: [: /var/spool/mail: integer expression expected
This error mean values of $usep variable is null...

debug it using sh -x <scriptname.sh>
and check why the value of /var/spool/mail is cuming null.

u'll be able to kno the error

Regards,
Pankaj
# 9  
Old 01-31-2008
MySQL Thanks Pankaj

Thanks Pankaj Smilie
# 10  
Old 02-01-2008
CPU & Memory require help for Shell Script

Hi finally i used this script but i can not remove blank lines from output then while it compare with 90 it gives me error like " expr: syntax error "
this is just because of BLANK LINES

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

#!/bin/bash
df -h | while read name
do
aa=$(echo $name | grep -v 172.16.0.15:/var/spool/mail | grep -v 172.16.0.15:/tftpboot/node_root/var/lib/dpkg | grep -v 172.16.0.15:/neuralit/work | grep -v 172.16.0.2:/tftpboot/node_root | grep -v 172.16.0.2:/tftpboot/nodes/172.16.0.112/etc | grep -v 172.16.0.2:/tftpboot/nodes/172.16.0.112/var | grep -v Filesystem | grep % | grep -v ^$ )
echo $aa

for i in $aa ; do
if [ "$i" == " " ]; then
echo "empty"
fi
done

bb=$(echo $aa | awk '{print $4 }' )

echo $bb

cc=$(expr substr $bb 1 2 )

echo $cc

if test $cc -gt 90
then
echo " size greater than 90%"
fi

done

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


please help me


Thanks & Regards
Jagannath Nikam
# 11  
Old 02-01-2008
require help for Shell Script

Can anybody overthere who look on above script ..................>>>?
# 12  
Old 02-01-2008
Please be aware this is a Free Forum, people here help because they want to. Using bold large red caps and demanding service, is going to get you ignored real quick! Even if you was paying people, that's not going to get you very far.

My systems don't have a 'df -h' option, so I tested this wtih 'bdf -l" for HP-UX and "df -lk" for Solaris, so you'll need to substitute your 'df -h'.

I'm printing "disk", "percentage" and the "full or has space message"

Code:
## Disk full
bdf -l | awk '$5~/100|9[0-9]/{print $1,$5,"Disk Full" }'

## Disk has space
bdf -l |  awk '$5~/[0-8][0-9]/{ if ($5 != "100%") print $1,$5,"Disk has space" }'

so you should be able to use the following:

Code:
## Disk full
df -h | awk '$5~/100|9[0-9]/{print $0,$5,"Disk Full" }'

## Disk has space
df -h |  awk '$5~/[0-8][0-9]/{ if ($5 != "100%") print $1,$5,"Disk has space" }'

# 13  
Old 02-04-2008
Question require help for Shell Script

Quote:
Originally Posted by denn
Please be aware this is a Free Forum, people here help because they want to. Using bold large red caps and demanding service, is going to get you ignored real quick! Even if you was paying people, that's not going to get you very far.

My systems don't have a 'df -h' option, so I tested this wtih 'bdf -l" for HP-UX and "df -lk" for Solaris, so you'll need to substitute your 'df -h'.

I'm printing "disk", "percentage" and the "full or has space message"

Code:
## Disk full
bdf -l | awk '$5~/100|9[0-9]/{print $1,$5,"Disk Full" }'

## Disk has space
bdf -l |  awk '$5~/[0-8][0-9]/{ if ($5 != "100%") print $1,$5,"Disk has space" }'

so you should be able to use the following:

Code:
## Disk full
df -h | awk '$5~/100|9[0-9]/{print $0,$5,"Disk Full" }'

## Disk has space
df -h |  awk '$5~/[0-8][0-9]/{ if ($5 != "100%") print $1,$5,"Disk has space" }'


Thanks for reply

Both are not working for me I am using Ubuntu Servers. I had mounted some network partition on that System thats why it shows wrong output

Please help me 2 solve this problem
Thanks & regards
# 14  
Old 02-04-2008
MySQL this code worked for me

df -k |tail -n +2| awk '{if($4~/100|9[0-9]%/)print $NF" is out or running out of space ****"; else print $NF" has enough space"}'

if this doesn't work for you can you send a df -k output from your systemSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script require to do telnet & run few commands

I am new in scripting, I need script(BASH) which do telenet to one of the elements & run few commands , after running it successfully it will check status of files & exit. Help is greatly appreciated 🙏 (2 Replies)
Discussion started by: Vinesh_123
2 Replies

2. UNIX for Beginners Questions & Answers

Require help in creating a Sudo/Shell script

Hello Friends, I have a scenario to create a script, I know many of you feel this as simple script. I am not much familiar with unix scripting, please help me out. Situation:- 1. I have a list of config files like 40+ would be getting deployed in the /app/abcd/src/Config/ (This will... (2 Replies)
Discussion started by: ganjvin
2 Replies

3. Shell Programming and Scripting

How to automate a script that would require authentication?

Hey everyone... I'm just stretching my wings a bit and seeing how things work. If I wanted to write a script that had me ssh to my remote computer, how can this be done? If the script runs without me, how can I enter the required password? the same is true for any time of authentication method like... (2 Replies)
Discussion started by: Lost in Cyberia
2 Replies

4. Shell Programming and Scripting

Require single command to start script in multiple servers

I have 9 servers, on each server a script with common name is available. I send a token file to all server from 1 particular server. so when a daemon job checks that token file is available then it triggers the script.. I want to know is there any command or script which I will run/execute on... (16 Replies)
Discussion started by: mirwasim
16 Replies

5. Programming

REQUIRE HELP IN WRITING A PERL SCRIPT

Hi everyone I am a beginner in perl and I am trying to write a perl script. Basically I want to separate gene entries from phenotype entries in a text file which contains huge number of records and copy them in a separate file. The gene entries will have * symbol after the line FIELD TI. A... (7 Replies)
Discussion started by: kaav06
7 Replies

6. Shell Programming and Scripting

sed help require

sed 's/abcd/$variable/g' abcd_calls > $variable_calls This is the statement i am trying which has 2 errors in it. 1st- sed 's/abcd/$variable/g' is changing abcd to $variable in the file abcd_calls ,I want it to convert abcd into the string value given by user through read command, taking... (1 Reply)
Discussion started by: learnbash
1 Replies

7. Shell Programming and Scripting

Require script to create two files

Hi folks, I have a input.file with the following contents:- flor geor enta vpal domi pegl cars mted four rose annc gabi ward dalv elph beac (8 Replies)
Discussion started by: mithalr
8 Replies

8. Solaris

Require some way or shell in which commands doesnot gets logged in history file

Guys, can u tell me some way in which the commands i execute on solaris system doesnot gets logged. It should not appear in history file.. Is there any shell which provide such solution or can I turn off the logging, if yes then how... Help will be appreciated Thanks (2 Replies)
Discussion started by: harpreetrekhi
2 Replies

9. UNIX and Linux Applications

Getmail help require

Hi all, I am retrieving mail from live mail server to local mail server. I want to know that, how can i exclude some peoples from getmail domain retrival. verbose = 1 read_all = true delete_after = 30 message_log = ~/.getmail/log type = MultidropIMAPRetriever server = mail.abc.com... (0 Replies)
Discussion started by: jagnikam
0 Replies

10. Shell Programming and Scripting

Regarding use and require keywords

Hi, what is the difference between use and require keywords in Perl. What is the significance of these lines (what it mean, what is the use of this) #!/usr/bin/perl -w // In Perl script.... #!/bin/ksh //In shell script..... Thanks Sweta (2 Replies)
Discussion started by: sweta
2 Replies
Login or Register to Ask a Question