Sponsored Content
Top Forums Shell Programming and Scripting Problem with a script on a solaris 10 box Post 302420859 by gnom on Wednesday 12th of May 2010 06:03:17 PM
Old 05-12-2010
Problem with a script on a solaris 10 box

Hi Gurus
I have several SAN's in two different locations. I collect performance data and archive them. In one location the archiving script runs on a solaris 9 server and in the other on a solaris 10 server. But the script fails every day on the solaris 10 server with this
Code:
mes6=`/usr/bin/du -sk *${yesterday}* | /usr/bin/awk '{print $1}'`

I tried everything, even a redirect to a /tmp/output.txt to see what the output is. It is always 0

Code:
#!/usr/bin/sh

date=`date +'%Y%m%d'`
#yesterday=`expr $date - 1`
yesterday=`perl -e '@T=localtime(time-86400);printf("%02d%02d%02d",$T[5]+1900,$T[4]+1,$T[3])'`
dir=`date +'%m%y'`
host=`uname -n`

set -x
test ! -d $dir && mkdir $dir

cd /var/tmp/performance/controller
tar cvf controller_$yesterday.tar *${yesterday}*.txt
        mes1=`tar tvf controller_$yesterday.tar | wc -l`
/usr/bin/gzip *.tar
test ! -d archive/$dir && mkdir archive/$dir
/usr/bin/mv *.tar.gz archive/$dir/
        cd archive/$dir
        mes4=`du -sk *${yesterday}* | awk '{print $1}'`
cd /var/tmp/performance/controller
rm *${yesterday}*.txt

cd /var/tmp/performance/volume
tar cvf volume_$yesterday.tar *${yesterday}*.txt
        mes2=`tar tvf volume_$yesterday.tar | wc -l`
/usr/bin/gzip *.tar
test ! -d archive/$dir && mkdir archive/$dir
/usr/bin/mv *.tar.gz archive/$dir/
        cd archive/$dir
        mes5=`du -sk *${yesterday}* | awk '{print $1}'`
cd /var/tmp/performance/volume
rm *${yesterday}*.txt

cd /var/tmp/performance/array
tar cvf array_$yesterday.tar *${yesterday}*.txt
        mes3=`tar tvf array_$yesterday.tar | wc -l`
/usr/bin/gzip *.tar
test ! -d archive/$dir && mkdir archive/$dir
/usr/bin/mv *.tar.gz archive/$dir/
        cd archive/$dir
        mes6=`/usr/bin/du -sk *${yesterday}* | /usr/bin/awk '{print $1}'`
        echo $mes6 >> /tmp/output.txt
cd /var/tmp/performance/array
rm *${yesterday}*.txt

#send a webops message if too less files
if [ $mes1 -lt 720 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes1 controller messages on $host, check script"
fi

if [ $mes2 -lt 720 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes2 volume messages on $host, check script"
fi


if [ $mes3 -lt 720 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes3 array messages on $host, check script"
fi

#send a webops message if .tar.gz is too small in size
if [ $mes4 -lt 250 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes4 kb controller messages on $host, check script" 
fi

if [ $mes5 -lt 250 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes5 kb volume messages on $host, check script"
fi

if [ $mes6 -lt 33 ]; then
        /usr/local/bin/webopsmsg.pl -s 4 -m "Only $mes6 kb array messages on $host, check script"
fi

So I have everyday webops messages and tickets.

Can you tell me whats wrong? Is it a problem with the solaris 10 server? On the solaris 9 server it runs without any probem.

Thanks in advance for your input.
gnom
 

10 More Discussions You Might Find Interesting

1. Solaris

Error on Solaris box

We are getting the following error: warning: pm: Can't set power level of TSI, gfxp to level 0 The machine is running Solaris 8. I think it is a SUn 220R box. Any ideas what this means? (2 Replies)
Discussion started by: hshapiro
2 Replies

2. Shell Programming and Scripting

Script to Reboot a linux box from a windows box

HI All, I need a script to reboot a linux box from a windows box. The script needs to run automatically whenever a sitescope alerts with an error message. Have searched for this in the forums, but could not get something relative. Pls. let me know the various alternatives we have to do... (2 Replies)
Discussion started by: Crazy_murli
2 Replies

3. UNIX for Dummies Questions & Answers

difference between AIX box and Sun Solaris box

Hi, I need a clarification. Is there any difference between AIX box and Sun Solaris box? The bzip command with -c option works in AIX box and the same does not work in Sun Solaris box. Can anyone please explain if there is an implementation difference in both these boxes for the shell... (1 Reply)
Discussion started by: nisha4680
1 Replies

4. Shell Programming and Scripting

Box A's perl script calling box B's shell script

Hi all, i have a perl script one server. I am running a cronjob to execute my perl script. #! /usr/bin/perl ... ... ... #call a shell script on another server How can i accomplish #? Do i have to issue a system (" ssh -l username server | shellscript.sh") in my shell script? or is there a... (1 Reply)
Discussion started by: new2ss
1 Replies

5. Shell Programming and Scripting

calling a unix script in one box from another box

i have a unix script which is available in a box say box1 i want this script to be run in box box2 and put the output file in box2 what is the procedure to execute this script in box2 i will call the script in box1 using cybermation (1 Reply)
Discussion started by: trichyselva
1 Replies

6. Shell Programming and Scripting

sftp script needed for solaris box

Hi , I have a solaris box through which i need to connect to ATM's and pull files using sftp. I did same type of scripting using ftp before but no sftp.The problem now i am facing is, i want to put the password along with this sftp (non-interactive) script. Unfortunately there is no... (3 Replies)
Discussion started by: Renjesh
3 Replies

7. Shell Programming and Scripting

ftp file starting with particular name on Windows box to Unix box using shell script

Hello all ! I'm trying to write a shell script (bash) to ftp a file starting with particular name like "Latest_" that is present on a Windows box to UNIX server. Basically I want to set this script in the cron so that daily the new build that is posted on the Windows box can be downloaded to the... (2 Replies)
Discussion started by: vijayb4u83
2 Replies

8. Solaris

E1 on Solaris box

hi, can someone please guide me if there is any special hardware to use when we need to terminate an E1/T1 link on a Solaris10 box. I have a number of boxes and these all are located at longer distances. the only connectivity is the E1 links between these far location locations. Would it be... (0 Replies)
Discussion started by: busyboy
0 Replies

9. Shell Programming and Scripting

Need a script to add mutiple printers in solaris box

Hi , i need to configure around 80 printers in a server. can someone please help me with the script. i have a file that has printer name and its ip. like. printer1 1.1.1.1 printer2 0.0.0.0 and so on.. can some one please help me to do it via script. i am using solaris 10 ... (0 Replies)
Discussion started by: chidori
0 Replies

10. Shell Programming and Scripting

Notify when the script run(hourly)on my jump-box only when there is a failure on my remote-box

Team, Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Discussion started by: whizkidash
6 Replies
DLB(6)								   Games Manual 							    DLB(6)

NAME
dlb - NetHack data librarian SYNOPSIS
dlb { xct } [ vfIC ] arguments... [ files... ] DESCRIPTION
Dlb is a file archiving tool in the spirit (and tradition) of tar for NetHack version 3.1 and higher. It is used to maintain the archive files from which NetHack reads special level files and other read-only information. Note that like tar the command and option specifiers are specified as a continuous string and are followed by any arguments required in the same order as the option specifiers. This facility is optional and may be excluded during NetHack configuration. COMMANDS
The x command causes dlb to extract the contents of the archive into the current directory. The c command causes dlb to create a new archive from files in the current directory. The t command lists the files in the archive. OPTIONS AND ARGUMENTS
v verbose output f archive specify the archive. Default if f not specified is LIBFILE (usually the nhdat file in the playground). I lfile specify the file containing the list of files to put in to or extract from the archive if no files are listed on the command line. Default for archive creation if no files are listed is LIBLISTFILE. C dir change directory. Changes directory before trying to read any files (including the archive and the lfile). EXAMPLES
Create the default archive from the default file list: dlb c List the contents of the archive 'foo': dlb tf foo AUTHOR
Kenneth Lorber SEE ALSO
nethack(6), tar(1) BUGS
Not a good tar emulation; - does not mean stdin or stdout. Should include an optional compression facility. Not all read-only files for NetHack can be read out of an archive; examining the source is the only way to know which files can be. 4th Berkeley Distribution 28 Oct 1993 DLB(6)
All times are GMT -4. The time now is 02:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy