LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-22-2011, 11:44 AM   #1
raulab
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Rep: Reputation: 0
run a shelll script from another shell script in another directory


Hi,

I am trying to stop weblogic using a shell script but it says

line 30: ./stopWeblogic.sh: No such file or directory
weblogic stopped

Here is the script
________________________________
#!/bin/bash
cd /admin/Oracle/Middleware/user_projects/domains/base_domain/bin
pwd
ls -ltrh
./stopWeblogic.sh
echo "weblogic stopped"


I added /admin/Oracle/Middleware/user_projects/domains/base_domain/bin to the path but still no luck. If I manually browse to the directory /admin/Oracle/Middleware/user_projects/domains/base_domain/bin using ssh and then run ./startWeblogic.sh it works fine.

Same thing If i try to run this commond from some other directory it does not work. But when I cd to this directory and issue ./stopWeblogic.sh it works.

/admin/Oracle/Middleware/user_projects/domains/base_domain/stopWeblogic.sh does not work from another directory

What am I doing wrong here?

Last edited by raulab; 02-22-2011 at 12:02 PM.
 
Old 02-22-2011, 11:52 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
You have a reference to ./stopWeblogic.sh twice. You need to delete one of the entries of it. Hope that helps...
 
Old 02-22-2011, 12:01 PM   #3
vigilandy
Member
 
Registered: Mar 2010
Location: Tokyo
Distribution: Arch, Fedora
Posts: 71

Rep: Reputation: 23
if you know the path of the script, just call the script directly.

Code:
#!/bin/bash
echo "stopping weblogic..."
/admin/Oracle/Middleware/user_projects/domains/base_domain/bin/stopWeblogic.sh
echo "weblogic stopped"
 
Old 02-22-2011, 12:02 PM   #4
raulab
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Original Poster
Rep: Reputation: 0
I removed it. Still the same issue.
 
Old 02-22-2011, 12:05 PM   #5
raulab
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Original Poster
Rep: Reputation: 0
scripts]$ /admin/Oracle/Middleware/user_projects/domains/base_domain/bin/stopWeblogic.sh
-bash: /admin/Oracle/Middleware/user_projects/domains/base_domain/bin/stopWeblogic.sh: No such file or directory

bin]$ pwd
/admin/Oracle/Middleware/user_projects/domains/base_domain/bin
bin]$ ls
nodemanager service_migration startManagedWebLogic.sh stopManagedWebLogic.sh
server_migration setDomainEnv.sh startWebLogic.sh stopWebLogic.sh


bin]$ ls -ltrh
total 48K
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 service_migration
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 server_migration
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 nodemanager
-rwxr-x--- 1 oracle oracle 2.1K Feb 22 00:52 stopWebLogic.sh
-rwxr-x--- 1 oracle oracle 2.4K Feb 22 00:52 stopManagedWebLogic.sh
-rwxr-x--- 1 oracle oracle 5.6K Feb 22 00:52 startWebLogic.sh
-rwxr-x--- 1 oracle oracle 3.2K Feb 22 00:52 startManagedWebLogic.sh
-rwxr-x--- 1 oracle oracle 13K Feb 22 00:55 setDomainEnv.sh
 
Old 02-22-2011, 12:10 PM   #6
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
It seems silly, but are you the owner of the Script? make sure the script has the permission to run the file named 'stopWeblogic.sh'
 
Old 02-22-2011, 12:12 PM   #7
raulab
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Original Poster
Rep: Reputation: 0
i am using the same owner "oracle" to run the script that i use to run that script manually. Same exact ssh session same owner
 
Old 02-22-2011, 12:21 PM   #8
vigilandy
Member
 
Registered: Mar 2010
Location: Tokyo
Distribution: Arch, Fedora
Posts: 71

Rep: Reputation: 23
does the oracle user have the necessary permissions for all the parent directories?
 
Old 02-22-2011, 12:22 PM   #9
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
can u paste the long listing for the original script please?
 
Old 02-22-2011, 12:29 PM   #10
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
i think user named 'oracle' has all the necessary permission thats why as 'oracle' user he is able to run the script manually
 
Old 02-22-2011, 12:35 PM   #11
vigilandy
Member
 
Registered: Mar 2010
Location: Tokyo
Distribution: Arch, Fedora
Posts: 71

Rep: Reputation: 23
Quote:
Originally Posted by raulab View Post
Same thing If i try to run this commond from some other directory it does not work. But when I cd to this directory and issue ./stopWeblogic.sh it works.
varindersingh, when he tries to run from a different directory, it doesn't work...
 
Old 02-22-2011, 01:29 PM   #12
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
$ ls -ltrh
total 48K
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 service_migration
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 server_migration
drwxr-x--- 2 oracle oracle 4.0K Feb 22 00:52 nodemanager
-rwxr-x--- 1 oracle oracle 2.1K Feb 22 00:52 stopWebLogic.sh
-rwxr-x--- 1 oracle oracle 2.4K Feb 22 00:52 stopManagedWebLogic.sh
-rwxr-x--- 1 oracle oracle 5.6K Feb 22 00:52 startWebLogic.sh
-rwxr-x--- 1 oracle oracle 3.2K Feb 22 00:52 startManagedWebLogic.sh
-rwxr-x--- 1 oracle oracle 13K Feb 22 00:55 setDomainEnv.sh
Quote:
#!/bin/bash
cd /admin/Oracle/Middleware/user_projects/domains/base_domain/bin
pwd
ls -ltrh
./stopWeblogic.sh
echo "weblogic stopped"
stopWebLogic.sh != stopWeblogic.sh

The filesystem is case-sensitive.

Last edited by Dark_Helmet; 02-22-2011 at 01:43 PM.
 
1 members found this post helpful.
Old 02-22-2011, 05:18 PM   #13
raulab
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Original Poster
Rep: Reputation: 0
thanks that was the issue. Sorry my bad . I should have been more careful
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script help: How to pass a directory path to the script? dv502 Programming 13 09-10-2008 03:07 AM
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 09:56 AM
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 03:23 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration