ls command gives "Not a directory" error message


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls command gives "Not a directory" error message
# 1  
Old 10-23-2010
ls command gives "Not a directory" error message

The operating system is Solaris. There is a perl interpreter that is located at /opt/perl5.10.0/perl. when i give
ls -ltr /opt/perl5.10.0/perl
I get an error message saying that "/opt/perl5.10.0/perl Not a directory"
At the next instant when i give the same command it lists the properties of the file. For the next 12 minutes or so ls -ltr /opt/perl5.10.0/perl produces no error message. After 12 minutes, the server seems to forget the path /opt/perl5.10.0/perl [i.e when i give ls -ltr /opt/perl5.10.0/perl after 12 minutes it gives an error message Not a directory.]

I have a perl script that is run from autosys. This script makes use of the above perl interpreter. The job fails for the first time and then runs for second time and goes to success for the above mentioned reason. Can someone please help me find out the cause of the problem and shed some light on the solution.
Smilie
This problem is quite funny and I have not come across this error message for ls command when i googled.
# 2  
Old 10-23-2010
I don't know how autosys is interfaced with the system nor whether or not it calls routine systems about schedule related things.
But i know that i've already met a bug that was making the cron not 100% reliable.

One of you monitoring scheduled script that sould be run every n minutes was running every n minutes, but some randomized times, it was just missing a run (this by forcing the script to generate a log file every run that i located this issue.

That was a solaris 10 bug that got fixed patching with last patch update.

Don't know whether it has something to with you prob but it might be something to check... if you run this OS.

otherwise check environment settings at time you are running your script as well as the availibility of the directory.
Is this dir synchronized with another one ? any NFS or automount stuff in this tree ? no inode table issue ?
truss your failling command and see if you find something in the log

Last edited by ctsgnb; 10-23-2010 at 10:29 AM..
# 3  
Old 10-23-2010
I suspect this error might be caused by /opt/perl5.10.0 being a link or a mountpoint to a remote file server and the latter service being faulty.
This User Gave Thanks to jlliagre For This Post:
# 4  
Old 10-23-2010
The error message suggests that /opt/perl5.10.0/perl is the current Shell.
If your script starts with a shebang line for perl, any error messages will be attributes to that instance.

We assume that /opt/perl5.10.0/perl is a file not a directory because you describe it as a file.

Assuming that it is a file, you can generate the error message with commands such as "cd /opt/perl5.10.0/perl" .

What is in your script?
# 5  
Old 10-24-2010
hi sreeharshasn

looks like /opt/perl5.10.0/perl is on mount point which is mounted using autofs
which drops the mount point after certain period of idle time.

when u do ls -lrt /opt/perl5.10.0/perl at that time it does not exist it needs to be mounted first .. so for the first time ls -lrt returns error but that mounts that directory .. so that mount will work for some time ( that time is decided in auto mount )

if you want to make sure ( below commands runs on Linux )

Code:
$ cd /opt ; df . 
check the output of above command .. if auto mounted you will see autofs and PID in bracket  

$ service autofs status 
check if /opt or /opt/perl5.10.0 is listed there ..it will also list timeout count in seconds 

if not on linux, run below command 

$ /etc/init.d/autofs status

i have faced same issue in which particular directory was not accessible first time you use it after reboot ..

hope this solves your problem Smilie
This User Gave Thanks to zedex For This Post:
# 6  
Old 10-26-2010
Thanks everyone for helping me understand the situation. The perl interpreter was actually mounted when the first time an ls command was given.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Red Hat

Postfix keeps returning "Command time limit exceeded" message

We are having issues with our Postfix. The POP and IMAP services randomly stops working an sent e-mails return a "Command time limit exceeded". We've found out that running these command fix the problem: service cyrus-imapd stop rm /var/lib/imap/tls_sessions.db* rm... (2 Replies)
Discussion started by: GustavoAlvarado
2 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Forum Support Area for Unregistered Users & Account Problems

Cannot register due to "spam" error message

Hi all, I am trying to register but it seems my IP address is being seen or black listed as a spam address. I get the following message: "Registration denied. Sorry, The UNIX and Linux Forums runs an active policy of not allowing spammers. Please contact us via by posting in this forum if... (0 Replies)
Discussion started by: codenjanod
0 Replies

7. UNIX for Dummies Questions & Answers

suppressing an error message using the "ls" command

hi I'm new here so my question maybe be retarded or out of place: Is there a way to suppress the "No such file or directory" error message when using the "ls" command ? thanks (5 Replies)
Discussion started by: basher400
5 Replies

8. Shell Programming and Scripting

"syntax error at line 21 :'done' unexpected." error message"

I am trying to run the script bellow but its given me "syntax error at line 20 :'done' unexpected." error message" can someone check to see if the script is ok? and correct me pls. Today is my first day with scripting. Gurus should pls help out #!/bin/ksh # Purpose: Check to see if file... (3 Replies)
Discussion started by: ibroxy
3 Replies
Login or Register to Ask a Question