|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
When I login as 'scott' , I can successfully execute a shell-script
which calls 'sqlplus' command from it. But I am unable to execute it as cron job because sqlplus does not execute properly. I logged in as 'scott', and added the following line to crontab : 5 * * * * full_path/my_cmd param1 param2 But it does not work. I get the error : ORA-07217 : sltln: environemnt variable cannot be evaluated. So I modified crontab entry to : 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 This generates the error : su : Sorry. Presumably it expects the user's (scott's) password to be supplied. So I logged in as root and added an entry to crontab : 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 This has better success but when I executes my_cmd, it does not find the command sqlplus because sqlplus is not in its PATH . So I logged in as root and added an entry to crontab : 5 * * * * /usr/bin/su scott -c full_path/interm_script Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/ bin This has better success because sqlplus is now in its PATH . But I still get the error : Message file sp1<lang>.msb not found. Error 6 initializing SQL*Plus. Ideally I would like to manipulate just my own crontab, instead of the root's crontab. Ability to somehow pass password to 'su' command in a crontab line might be crucial to achieving this. I do not know how to manage it. But even if the root can set up a proper cronjob, I will be happy. Please advise. Thanks in advance. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
dn.perl@gmail.com wrote:
> When I login as 'scott' , I can successfully execute a shell-script > which calls 'sqlplus' command from it. But I am unable to execute it > as cron job because sqlplus does not execute properly. > > I logged in as 'scott', and added the following line to crontab : > 5 * * * * full_path/my_cmd param1 param2 > But it does not work. > I get the error : ORA-07217 : sltln: environemnt variable cannot be > evaluated. > > So I modified crontab entry to : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This generates the error : su : Sorry. > Presumably it expects the user's (scott's) password to be supplied. > > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This has better success but when I executes my_cmd, it does not find > the command sqlplus because sqlplus is not in its PATH . > > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/interm_script > > Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/ > bin > This has better success because sqlplus is now in its PATH . But I > still get the error : > Message file sp1<lang>.msb not found. > Error 6 initializing SQL*Plus. > > Ideally I would like to manipulate just my own crontab, instead of the > root's crontab. Ability to somehow pass password to 'su' command > in a crontab line might be crucial to achieving this. I do not know > how to manage it. > > But even if the root can set up a proper cronjob, I will be happy. > > Please advise. Thanks in advance. > Because su -c starts a sub shell, you must quote the words, so the current shell sees one string (argument), while the sub shell sees the words (arguments): su scott -c "full_path/my_cmd param1 param2" -- Michael Tosch @ hp : com |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Tue, 17 Jul 2007 21:46:18 -0000, dn.perl@gmail.com
<dn.perl@gmail.com> wrote: > > Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/ > bin > This has better success because sqlplus is now in its PATH . But I > still get the error : > Message file sp1<lang>.msb not found. > Error 6 initializing SQL*Plus. > You may need to set LANG as it is set when you log in. > Ideally I would like to manipulate just my own crontab, instead of the > root's crontab. Ability to somehow pass password to 'su' command > in a crontab line might be crucial to achieving this. I do not know > how to manage it. > You shouldn't need su to execute a script as yourself. You just need to set the proper environment variables. -- Education is learning what you didn't even know you didn't know. -- Daniel J. Boorstin |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Jul 17, 4:46 pm, "dn.p...@gmail.com" <dn.p...@gmail.com> wrote:
> When I login as 'scott' , I can successfully execute a shell-script > which calls 'sqlplus' command from it. But I am unable to execute it > as cron job because sqlplus does not execute properly. > > I logged in as 'scott', and added the following line to crontab : > 5 * * * * full_path/my_cmd param1 param2 > But it does not work. > I get the error : ORA-07217 : sltln: environemnt variable cannot be > evaluated. > > So I modified crontab entry to : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This generates the error : su : Sorry. > Presumably it expects the user's (scott's) password to be supplied. > > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This has better success but when I executes my_cmd, it does not find > the command sqlplus because sqlplus is not in its PATH . > > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/interm_script > > Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/ > bin > This has better success because sqlplus is now in its PATH . But I > still get the error : > Message file sp1<lang>.msb not found. > Error 6 initializing SQL*Plus. > > Ideally I would like to manipulate just my own crontab, instead of the > root's crontab. Ability to somehow pass password to 'su' command > in a crontab line might be crucial to achieving this. I do not know > how to manage it. > > But even if the root can set up a proper cronjob, I will be happy. > > Please advise. Thanks in advance. I'm pretty sure you want su - scott -c. You need the " - " get the the users env. Miles |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
dn.perl@gmail.com <dn.perl@gmail.com> wrote:
> When I login as 'scott' , I can successfully execute a shell-script > which calls 'sqlplus' command from it. But I am unable to execute it > as cron job because sqlplus does not execute properly. On some cron implementations, you can specify environment variables in the head of the crontab entry. Check man page "man 5 crontab" > I logged in as 'scott', and added the following line to crontab : > 5 * * * * full_path/my_cmd param1 param2 > But it does not work. > I get the error : ORA-07217 : sltln: environemnt variable cannot be > evaluated. > So I modified crontab entry to : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This generates the error : su : Sorry. > Presumably it expects the user's (scott's) password to be supplied. > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/my_cmd param1 param2 > This has better success but when I executes my_cmd, it does not find > the command sqlplus because sqlplus is not in its PATH . > So I logged in as root and added an entry to crontab : > 5 * * * * /usr/bin/su scott -c full_path/interm_script > Then in this intermediate_script, I exported PATH=$PATH:/apps/oracle/ > bin > This has better success because sqlplus is now in its PATH . But I > still get the error : > Message file sp1<lang>.msb not found. > Error 6 initializing SQL*Plus. > Ideally I would like to manipulate just my own crontab, instead of the > root's crontab. Ability to somehow pass password to 'su' command > in a crontab line might be crucial to achieving this. I do not know > how to manage it. > But even if the root can set up a proper cronjob, I will be happy. > Please advise. Thanks in advance. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"dn.perl@gmail.com" <dn.perl@gmail.com> writes:
> When I login as 'scott' , I can successfully execute a shell-script > which calls 'sqlplus' command from it. But I am unable to execute it > as cron job because sqlplus does not execute properly. > > I logged in as 'scott', and added the following line to crontab : > 5 * * * * full_path/my_cmd param1 param2 > But it does not work. > I get the error : ORA-07217 : sltln: environemnt variable cannot be > evaluated. If my_cmd is a script, source the startup files for scott. If it's a binary, wrap it in a script which does that, then calls my_cmd. You can't depend on any particular environment being active in a cron job, if you need one you just have to arrange for it to get setup. Joe |
|
![]() |
| Outils de la discussion | |
|
|