Yes, I do want the command executed - that is intended.
the mail_report variable will have output that looks like this:
The command is a two part command. Step one is just to run
nbdeployutil --gather
That will run for a length of time and generate several different files in a specified directory. It also spits out some output that looks like this:
I cut out the necessary part (the part that stays "run the following") and assign it to the mail_report variable and then execute it since it is the second step of the command to run to give me the final report.
This works interactively using the script, but not through cron.
You said that PATH doesn't matter. You said that when using cron, PATH is defined by:
Is nbdeployutil in /usr/sbin or in /usr/bin? Or is it in /usr/openv/netbackup/bin or one of its subdirectories that is in your PATH when you run it in an environment where it works successfully?
You said your script uses absolute pathnames for everything it executes. But, nbdeployutil is not an absolute pathname.
Hi Don, in this case I am using full paths in the script so the PATH environment variable doesn't come into play here. Further, the script works up to this line. I am able to tell this because the second temp file is never updated and the output file is never created. I think cron doesn't like this line
which works fine under the interactive shell.
Hi Don, in this case I am using full paths in the script so the PATH environment variable doesn't come into play here. Further, the script works up to this line. I am able to tell this because the second temp file is never updated and the output file is never created. I think cron doesn't like this line
which works fine under the interactive shell.
No, no, no! The PATH environment variable absolutely DOES COME INTO PLAY here. Using back quotes (shown in red above) asks the shell being run by cron to execute the command found between those quotes. The shell has to find that command in one of the directories specified by $PATH to be able to execute it unless you use an absolute pathname. The nbdeployutil in the command you are asking the shell to execute:
is not an absolute pathname and is not found in the directories listed in the PATH setting that is being used when you run this script under cron!
If you want this script to work under cron, you either need to change the way you set mail_report so it includes an absolute pathname for nbdeployutil or you need to set PATH so the shell being run by cron will be able to find nbdeployutil in one of the directories named in $PATH as it is set in cron's environment.
Last edited by Don Cragun; 01-05-2014 at 03:48 PM..
Reason: fix typo
Holy moly, Don! I hadn't even given that any thought (obviously)! I will give that a try and let you know, but I'm feeling pretty good that this is the issue!
Are you sure the script posted does run correctly when invoked interactively? The backticks will try to execute the contents of mail_report, whatever it contains, and will probably fail, printing an error msg. Again: what is the contents of mail_report?
Hi,
Could you please help me out in scheduling a mail through Unix command.
I am using "Corntab" and "at" but not able to schedule.
I use putty for Unix.
Thanks
Vinit Raj
---------- Post updated at 06:04 AM ---------- Previous update was at 06:02 AM ----------
Hi,
Could you please help me out in scheduling a mail through Unix command.
I am using "Corntab" and "at" but not able to schedule.
I use putty for Unix.
presently i am using this command
Thanks
Vinit Raj
Moderator's Comments:
Please do not hijack a discussion concerning a different issue. If you want help with this problem, please repost this question in a new thread.
Please also use CODE tags when sample code, sample input, or sample output.
Last edited by Don Cragun; 01-07-2014 at 03:16 PM..
I wish to replace "\\n" with a single white space.
The below does the job on command-line:
$ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g';
/fin/app/scripts /fin/app/01/sql
However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
The following bash script fails with error message: "./phpquery_KNBB_html_reader.sh: line 65: syntax error near unexpected token `done'" when do ./<scriptname> in the shell. However when I copy-paste the entire contents of the file directly into a shell environment it runs ok returning the intended... (2 Replies)
Hello everybody
Im learning bash scrpting language and im making a script that read a file line by line and it does a comparison if in a line start with a letter or number and it will delete every ones that start with a letter. But im getting some errors
First of all, this is the script's... (5 Replies)
Hi,
I have a ksh script that runs as root ans issues several commands as a user differente from root as 'su <user> -c "command" ' . It works fine except for one step where the command executes sql statements. That command fails with ORA-20000.
Now the strangest thing, if I place a read command... (5 Replies)
hi i have a script called test.sh. the content is ls >> crontest.txt.
if i run manually it's giving output.but if i scheduled in crontab it's not giving output.
crontab entry:
02 * * * * /sms5/SMSHOME/eds_sh/test.sh >> /sms5/SMSHOME/eds_sh/testfile/logfile 2>&1
I am using ksh.is there... (2 Replies)
OS is Ubuntu 8.04.3. When I run the command:
/usr/bin/syslogMailer < /etc/syslog.pipes/criticalMessagesFrom a bash shell it works and i receive an email as per the script however when run from crontab it does not work. Can anyone explain why and how to fix it?
/usr/bin/syslogMailer... (4 Replies)
Hi
I am a novice Linux/Perl user and am struggling to overcome what I am sure is a simple problem.
I am using a perl program to create a shell script daily containing between 10 and 30 "at -f" commands for the same day. Then I change the file attributes to allow the file to be executed. When... (2 Replies)
Hi Folks,
Could you please suggest me how to run a shell script on a solaris env without using crontab. I am actually trying to write a shell script which will grep "WORD" in the logfile andd sends a email.Thanks in advance.
Thanks
Sandeep. (3 Replies)
Hi
Im very new at working with unix and this problem I simply can not understand. I know there are a lot of threads about problems with shell scripts behaving differently when run from a terminal and from a cronjob. I have tried everything(almost) but I still havent cracked this problem.
Im... (15 Replies)