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
virt-tar-out(1) 					      Virtualization Support						   virt-tar-out(1)

NAME
virt-tar-out - Pack a virtual machine disk image directory into a tarball. SYNOPSIS
virt-tar-out -a disk.img /dir files.tar virt-tar-out -d domain /dir files.tar virt-tar-out -d domain /dir - | gzip --best > files.tar.gz DESCRIPTION
"virt-tar-out" packs a virtual machine disk image directory into a tarball. The first parameter is the absolute path of the virtual machine directory. The second parameter is the tar file to write. Use "-" to write to standard output. EXAMPLES
Download the home directories from a guest: virt-tar-out -d MyGuest /home - | gzip --best > homes.tar.gz JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "tar-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-copy-out(1), virt-edit(1), virt-tar-in(1), <http://libguestfs.org/>. AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011 Red Hat Inc. <http://libguestfs.org/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. libguestfs-1.18.1 2013-12-07 virt-tar-out(1)
All times are GMT -4. The time now is 07:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy