- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Assistance for the scripting-challengedb,&
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 08:14 AM
01-29-2003 08:14 AM
Recently, HP has provided me with a different version of this utility that better suits our current needs but when I plug it into my existing script I get 0 length files. The thing that kills me is that all I have done is to change the path and file that was originally in the script to the new one.
Here???s what I had:
#!/bin/sh
DIR=???/opt/reports/raw???
OUTPUT=???$DIR/events.???date +%Y%m%d??????
/opt/OV/bin/ovtopodump > $OUTPUT
echo ???Dump Complete???
Here???s what I tried to change it to:
#!/bin/sh
DIR=???/opt/reports/raw???
OUTPUT=???$DIR/events.???date +%Y%m%d??????
/opt/OV/contrib/NNM/HPC/dumpEvents.ovpl > $OUTPUT
echo ???Dump Complete???
The first one worked, the second one doesn???t. The only thing I can think of is the fact that I am now calling a OVPearl script which I wasn???t doing previously, but I have no idea how to solve this.
My knowledge and understanding of the arts of scripting are limited at best at this stage. Would someone be willing to show me the error of my ways?
Many thanks,
John
P.S. I would have stuck this in the OV furums section, but this seems more like something that could be better handled here. I've seen some pretty amazing scripts in this forum :-)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 08:21 AM
01-29-2003 08:21 AM
Re: Assistance for the scripting-challengedb,&
Does your OV command run stand alone? What happens when you do this from a shell prompt as the user that runs the script?:
/opt/OV/contrib/NNM/HPC/dumpEvents.ovpl
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 08:21 AM
01-29-2003 08:21 AM
Re: Assistance for the scripting-challengedb,&
if so, change the '>' to be '2>&1 |tee -a' to capture all the output.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 08:36 AM
01-29-2003 08:36 AM
Re: Assistance for the scripting-challengedb,&
Hi !,
Are you using this script inside the cron ? If yes, check the variables if they are set ok ! For this do a env command in the prompt.
Check also the output of the script, if runs manualy when you invoke it so take the output:
/opt/OV/contrib/NNM/HPC/dumpEvents.ovpl 2>&1 | tee -a log.txt
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 08:56 AM
01-29-2003 08:56 AM
Re: Assistance for the scripting-challengedb,&
Yes, it does run when I run it as the intended user. I already checked the permissions on it and found them to be correct.
Ian,
(see above for first answer).
As I stated, I am rather clueless as to the intricate designs behind this strange thing referred to as ???scripting???. Can you explain how making the change that you suggest would give me the output to the file name and path that I want? I just don???t see it from where I am now.
Ricardo,
You hit on something here that I should have mentioned. Yes, this is being kicked off by cron every 24 hours (funny how the important details slip the mind sometimes). On that note, I have checked the ???env??? settings on this and find that the directory is in an existing path statement. One question though. If I???m providing it with an absolute path to the .ovpl script, what difference would it make if it were in there or not (dunce question, I know???)?
All,
When I run the script at the command line, it does what I expect it to do. Re-reading my orriginal post, I guess I kind of screwed up on my initial catagorization of this. It probably should be something more like ???Cron for Dummies help needed???.
Any ideas from here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:00 AM
01-29-2003 09:00 AM
Re: Assistance for the scripting-challengedb,&
I'm don't know OpenView, but could your events be getting reset at midnight? Maybe when your cron job runs there isn't anything to report? What happens if you run the script in a cron job right now?
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:02 AM
01-29-2003 09:02 AM
Re: Assistance for the scripting-challengedb,&
If you run this script as root, you should check root's email to see if there is any error related to this cron.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:06 AM
01-29-2003 09:06 AM
Re: Assistance for the scripting-challengedb,&
John,
Just an idea: Didi you check the cron log file ?
/var/adm/cron/log
Maybe you cann find some useful information.
Regards,
Ricardo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:06 AM
01-29-2003 09:06 AM
Re: Assistance for the scripting-challengedb,&
John,
Just an idea: Did you check the cron log file ?
/var/adm/cron/log
Maybe you cann find some useful information.
Regards,
Ricardo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:07 AM
01-29-2003 09:07 AM
Re: Assistance for the scripting-challengedb,&
There are 4 types of shell i/o,
1. Stdin - This is when input is provided to a program from the shell. it used the < symbol.
eg. command < "options"
2. Stdout (Standard Output) - This is 'normal' screen output, like a "bdf".
eg bdf >/tmp/file1
3. Stderr (Standard Error) - This is error output, that is separated out from Standard Output. Unfortunately some packages (and programs) like to output things to stdout, and redirecting it using ">" does not work. You have to use "2>".
eg. bdf 2> /tmp/file
The above option puts any error output from the bdf to /tmp/file.
To combine the above two outputs (Stdout and Stderr), you use the "2>&1" command, which combines it to Stdout. This is half of what I have quoted above as an example.
4. Std-something - This is an anomaly that popped up in Ignite for me last year. It is output that does not appear on either Stdout or Stderr. So the "2>&1" option will not pick it up. However the "|" (pipe) with the "tee" (output branching) WILL pick up this output and save it to a file.
Hence "command 2>&1 |tee -a /tmp/file1" will capture Stderr, Stdout and Std-something, and append it to a file named /tmp/file1.
Is this what you were after?
Share and Enjoy! Ian
PS If you are a java guru, best check the java code to see which output stream you are sending the output to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 09:11 AM
01-29-2003 09:11 AM
Re: Assistance for the scripting-challengedb,&
"output things to stdout"
with
"output things to stderr" in the Stderr section.
Oops, fat fingers. Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 03:13 PM
01-29-2003 03:13 PM
Re: Assistance for the scripting-challengedb,&
John,
The particular service that I am tying into keeps a running log that goes up to a predetermined database size, not a time limit. Running the script in cron right now produces the same 0 length file.
Hai,
I thought about that not long after my last post in this thread and I can say without a doubt that the e-mail for root (which is what this is running under) has the standard message that it had prior to making the change above.
Ricardo,
I actually hadn???t thought about that before you mentioned it, but now that I have checked, I don???t find anything in there that looks any different than when it ran prior to the change. Thanks for pointing me there, though???
Ian,
Now I see what happens when a person is good enough to get a Wizard???s cap. Their responses become more difficult to follow :-)
Seriously, I need a little more clarification on what you have suggested. At the end of my cron entry I have the ???2>&1??? entry that you refer to. Are you saying that I can add the additional ???|tee ???a /tmp/file1??? after that and get even more detailed information then what I am already getting? Are you expecting that this will give me more detailed information on a failure of some kind?
Many thanks to you all,
John
P.S.
Java?? Isn???t that something that you drink? How do you check the code on a beverage? :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 03:26 PM
01-29-2003 03:26 PM
Re: Assistance for the scripting-challengedb,&
You mentioned in your follow up that it ran fine when you ran it manually; I assumed you meant that you saw more output on the screen, more than what appeared in the log file when the job was run through cron. Did I get it right?
Assuming thats the case, my above posting should capture the information you are missing. It would seem that the program is putting out text that is not getting picked up by by the "2>&1" condition.
I have an alternative solution, if it does not confuse the issue. If the script will not run at all in cron, then you need to set up environment variables.
But first lets see if I can figure out what the symptoms are.
Can you confirm which one it is; no output on the logfile or no execution within cron?
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2003 04:13 PM
01-29-2003 04:13 PM
Re: Assistance for the scripting-challengedb,&
I have done some further testing to try and duplicate this type of problem.
I created a script with a very low-level bug in it, and ran it in the normal shell and got the error reported.
I scheduled it in cron with "/tmp/test1 2>&1 >>/tmp/aa". Nothing was shown in /tmp/aa.
I altered the command "/tmp/test1 2>&1 |tee -a /tmp/aa" and got the error captured in /tmp/aa.
If you go ahead and place the " 2>&1 |tee -a " option against the command in crontab and run the job,
you will get some indication of what it finds as a problem.
Post the output and we'll see where we go from there. Share and Enjoy! Ian
PS Sorry about the technobabble - the brain works faster than the thesaurus sometimes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 01:49 AM
01-30-2003 01:49 AM
Re: Assistance for the scripting-challengedb,&
env | sed 's/\(^.*\)=\(.*\)/export \1="\2"/g' >env.out
Then put the contents of env.out to the top of your script.
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 09:23 AM
01-30-2003 09:23 AM
Re: Assistance for the scripting-challengedb,&
I???m not sure if you and I are getting our lines of communication crossed or I just don???t know how to explain this situation properly (I???m opting for the second), but I think that I have found something on this none the less.
As I mentioned, I have been going over the e-mail that this thing generates when it runs and I didn???t see anything different on this until this morning (why the e-mail message changed on it this morning is still a mystery). This morning it showed me an error stating that it ???could not open ovdumpevents at ???path???/dumpEvents.ovpl line 23.??? Of course, I found this new message in the e-mail after I had read your replies and made the changes to the cron to see if I could catch something new and was waiting on the cron to error out (funny how that works sometimes, isn???t it?).
Anyway, as if to prove the point further when the cron did error as expected I found the little text file that your new options provided me and it said the exact same thing. This led me to examine the pearl script more closely.
What I found was a few references to the ???ovdumpevents??? file embedded in the pearl script that don???t give a fully qualified path along with the file. I???m going out on a limb here, but it would seem to me that this is most likely the cause of the errors.
Now, the next question is regarding Pearl scripts and the particular quirks that surround them. Will Pearl allow me to simply go in and put a fully qualified path into these lines or do I have to get to this using path statements? Dietmar has given me a suggested way to find all the path statements (THANKS DIETMAR!) and dump them into a text file that I should be able to pre-pend to the script, but that is a whole bunch of paths and I would hate to have to put them all in if I can avoid it.
If Pearl will allow fully qualified paths, then I think I may have this whooped (as they say in these parts ;-)..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 09:27 AM
01-30-2003 09:27 AM
Re: Assistance for the scripting-challengedb,&
Oh my God! What???s happening to me?!?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 09:38 AM
01-30-2003 09:38 AM
SolutionPardon me for jumping in, but why mess with the Perl scripts? Just put a PATH statement in before you invoke the Perl script, like this:
#!/bin/sh
DIR=???/opt/reports/raw???
OUTPUT=???$DIR/events.???date +%Y%m%d??????
PATH=$PATH:/whereverthefileishiding
/opt/OV/contrib/NNM/HPC/dumpEvents.ovpl > $OUTPUT
echo ???Dump Complete???
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 02:29 PM
01-30-2003 02:29 PM
Re: Assistance for the scripting-challengedb,&
Logic says it should, but I know nothing about Pearl. The last thing I want to do is experiment and blow something up...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 03:17 PM
01-30-2003 03:17 PM
Re: Assistance for the scripting-challengedb,&
Do you have "." in your PATH variable for interactive
Do you have "." in your PATH variable for the cron job.
Sometimes a programmer may "cd" to a folder with other scripts/programs and run them by just entering the name of the script/program.
But this doesn't work unless "." is in your PATH variable.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 03:27 PM
01-30-2003 03:27 PM
Re: Assistance for the scripting-challengedb,&
Put the fully qualified path in the script and give it a shot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 03:30 PM
01-30-2003 03:30 PM
Re: Assistance for the scripting-challengedb,&
The forum lag has struck again. I made sure to refresh that page prior to putting my last post in and your post didn't show up. Sorry about that...
I wish I could give all of you the credit for this in the way of points because each of you helped in this.
Solution was ultimately related to the path statement as was mentioned earlier in the thread, but not in the expected place. The place where the path needed to be defined for was the Pearl script that was being called from the other script running in cron. For that reason, Pete's answer was the "icing on the cake".
Thanks to you all for the input and for putting up with some pretty stupid questions from my end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 03:35 PM
01-30-2003 03:35 PM
Re: Assistance for the scripting-challengedb,&
Sorry gentlemen but there must be something wrong with this browser. I didn't have either of your responses on the screen even after the last refresh or I would have mentioned you as well.
One question to Rodney:
Isn't putting the "." in the path a security hole?
Either way. Thanks to you two as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 03:48 PM
01-30-2003 03:48 PM
Re: Assistance for the scripting-challengedb,&
I only mentioned it because of what I thought your perl script was doing.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2003 01:05 AM
01-31-2003 01:05 AM
Re: Assistance for the scripting-challengedb,&
My next suggestion was going to be to place the command inside a script and run the command '. /.profile' before the script, and then 'cd' into the same directory you were in when you ran the command in the shell.
This will set up the environment variables and directory that was in place when the script could be made to work. Just posted it for future forum searchers to reference.
Anyway, glad you have a working solution. Null points pse.
Share and Enjoy! Ian
BTW, the fact that you understand the postings herein means you are beginning to be "assimilated" (Resistance is futile!)