-:::Don't understand this small script:::-
Hi Guys,
I don't understand this script, What does this line " cd `ls |grep -v tar`/disks" here???? Code:
-bash-3.00$ /usr/local/bin/sudo cat /users/sysmgr/ios Code:
Your "cron" job on server1 EDIT:-- This what I have in /opt/SUNWexplo/output/ Code:
-bash-3.00$ cd /opt/SUNWexplo/output/ |
Lets see...
cd `ls |grep -v tar`/disks so its trying to change directory to: (something without 'tar' in it)/disks. it depends on where you run this, whether it will work or not. pseudo: ls current directory grep for names without tar in it append it to /disks cd to (result)/disks |
Quote:
|
eh.. let me see here..
cd /opt/SUNWexplo/output/; cd `ls |grep -v tar`/disks So this 'disks' directory is a subdirectory somewhere in /opt/SUNWexplo/output. so go there, then try a: find . -name disks If you'd like to know where the disks directory is. |
Quote:
Code:
-bash-3.00$ ls -la disks |
This how it produces output when it runs well on other server.
Code:
Your "cron" job on server2 |
Quote:
So above cp erroris because of insufficient permissions on the file. Quote:
EDIT: assuming you dont have sufficient permisions to change the script... so for this to work fine you have to apply correct permissions on the file "*.out" and and rename the .gz file to something else. That should be it. |
[QUOTE=SAbhi;5016930]Result of a buggy script... you should always make sure the file or dir exists and has sufficient read and write permissions prior to use them anywhere in the script.
NO. this scripts works fine on other solaris 10 server. this script has started giving errors when we upgraded Sun Explorer version from 7.3 to 8.0. on this machine. |
Then downgrade explorer to 7.3 or upgrade your script to something that work with explorer 8.0.
If there is no such update, find out the people who wrote the script and ask them for support. If not available, figure out why and what something changed in the directory layout between the explorer releases. |
[QUOTE=manalisharmabe;5017257]
Quote:
Actually the script is sure a buggy script.. reasons i have already mentioned in the last post... it was working fine on other servers because they have the required file and permissions set already and hence it executed.. while when you upgraded a server and it dont have the required sets of permissions and already a archive present, the script should have statements checking that.. for the solution i already have mentioned in EDIT section of last comment. |
that script is .. bad and not as in good.
Warning: I have never used solaris. The below is Untested...even on gnu/linux may use 'features' not available to you no real error checking/reporting.. Code:
#!/usr/bin/bash
|
-bash-3.00$ cd /opt/SUNWexplo/output/
-bash-3.00$ ls -la total 12 drwxr-xr-x 3 root bin 512 Aug 27 14:50 . drwxr-xr-x 12 root bin 512 Jul 31 12:25 .. -r-------- 1 root root 11 Jul 29 02:06 .explastrun drwx------ 20 root root 512 Aug 27 14:50 explorer.844d540d.amspdmbep31-2013.08.27.07.02 -rw-r--r-- 1 root root 34 Aug 19 02:45 iostat_-E.out.gz -rw------- 1 root root 88 Jun 25 10:30 stderr.21762 -bash-3.00$ Hi Guys, I changed bash to ksh, as it was initially. I removed this two files:- Code:
-rw-r--r-- 1 root root 34 Aug 31 14:14 iostat_-E.out.gz I just compared the files with other servers where this scripts runs well and these 2 files were not there. Hopefully , I think I have got the solution now. Thanks a lot for all your replies. |
Thats exactly what you were told in my last post.
|
Hi Guys,
I Just reopened this thread due to one query. Whenever i run this comand /usr/local/bin/sudo /users/sysmgr/ios on command line only this line /opt/SUNWexplo/output/explorer.833b0e87.server1-2013.09.16.00.00/disks get produced but when I again run it, it get executed fully like this:- Code:
opt/SUNWexplo/output/explorer.833c0503.server1-2013.09.16.00.00/disks In first attempt this is how it attempts in mail in first attempt:- Code:
Your "cron" job on server1 What could be the problem that it does not hget executed in first run? Does it mean that it does not send system information to Sun Explorer Portal? Well, After first run I did check /opt/SUNWexplo/output folder but nothing speacial get created there. Please advise. |
Manali,
first of all whenever you are posting a new issue, use a new thread. Quote:
are you running this command command as a cron job or in a terminal seperately ??? if from a cron share the con entry, also share Code:
ls -l /opt/SUNWexplo/output/explorer.833c0503.server1-2013.09.16.00.00/disks |
All times are GMT -5. The time now is 01:41 AM. |