[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 632
  • Last Modified:

Unable to execute a symbolic link in linux

Running redhat enterprise linux 5. I created a symbolic link to a shell script but when I try to execute the symbolic link I get the message:
bash: ./stopall.sh: No such file or directory

My working directory is the directory containing the symbolic link and I tried executing it with the command:
./stopall.sh

Is there some other step I need to perform?
0
opike
Asked:
opike
  • 3
  • 3
  • 2
1 Solution
 
TintinCommented:
What does

ls -l stopall.sh

show?
0
 
rfportillaCommented:
I dont' think your file is executable.  Either use

  chmod +x stopall.sh

or try

  . stopall.sh

Notice the . with a space after.
0
 
opikeAuthor Commented:
Here is the output from ls -la (links definitely have execute permission set):

[ollie@oracleepm oraclelinks]$ ls -la
total 12
drwxrwxr-x  2 ollie ollie 4096 Sep 11 17:30 .
drwx------ 23 ollie ollie 4096 Sep 12 08:12 ..
lrwxrwxrwx  1 ollie ollie    8 Sep 11 17:25 startall.sh -> start.sh
lrwxrwxrwx  1 ollie ollie   15 Sep 11 17:30 startEssbase.sh -> startEssbase.sh
lrwxrwxrwx  1 ollie ollie    7 Sep 11 17:25 stopall.sh -> stop.sh
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
TintinCommented:
There's your problem, you have a symbolic link pointing to a non-existent file.

Where does stop.sh exist?

You need to do

ln -s  /some/path/to/stop.sh stopall.sh
0
 
rfportillaCommented:
That does kind of raise an interesting point.  I see that the file is executable, but it is pointing to something that is in the local directory or available through the path variable.  Does "./stop.sh" work?  Does ". stop.sh" work?  And, do the others work, startall.sh and startEssbase.sh?

 
0
 
TintinCommented:
rfportilla.

The symlinks won't work as they point to non-existent files.  Simple as that.
0
 
rfportillaCommented:
@tintin, just checking all bases.  Seems like an odd question to ask about one particular symlink if none are working.  I just wanted to make sure that none of them are working.  No need to blast me... :-p
0
 
opikeAuthor Commented:
Mixed up order of arguments...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now