LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-30-2010, 05:03 AM   #1
davemaclurg
LQ Newbie
 
Registered: Sep 2010
Location: Perth, Scotland
Posts: 3

Rep: Reputation: 0
No such File or Directory


I am migrating an application from HP-UX to Redhat Linux and I have some files of scripts. In one of the script files I have the line
/pylive/smartPAY/spserver/scripts/sp.con
which is the correct path and file name for an existing file.
However I get the message
"No such File or Directory/pylive/smartPAY/spserver/scripts/sp.con"
The script worked fine in HP-UX, why not in Redhat Linux?

Thanks
Dave MacLurg
 
Old 09-30-2010, 05:24 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Be nice to know exactly how you are running it, but that particular msg normally means the process trying to run the prog does not have the right ot do so, usually wrong ownerships.
Check ownrships & perms of dir/file and user/process attempting to run it.
 
Old 09-30-2010, 05:24 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Please show the output for:
Code:
ls -l /pylive/smartPAY/spserver/scripts/sp.con
 
Old 09-30-2010, 06:37 AM   #4
davemaclurg
LQ Newbie
 
Registered: Sep 2010
Location: Perth, Scotland
Posts: 3

Original Poster
Rep: Reputation: 0
I run

/usr/sbin/spmenu

which contains the line

/pylive/smartPAY/spserver/scripts/sp.con

I get the message

"No such file of directory/pylive/smartPAY/spserver/scripts/sp.con"


When, from the command prompt, I run

/pylive/smartPAY/spserver/scripts/sp.con

which contains:-


trap ":" 1 2 3 14 15
# TERM=ansi;export TERM
ANS=0
SPAYSCR=./pylive/smartPAY/spserver/scripts
cd $SPAYSCR
while true
do
tput clear
echo ""
echo ""
echo ""
echo " Control Menu For smartPATH"
echo " =========================="
echo ""
echo " 1. Start the SmartPATH database servers."
echo " 2. Stop the SmartPATH database servers."
echo ""
echo " 3. Server Editor."
echo " 3a. PAY2000 -> smartPAY Conversion."
echo ""
echo " 4. Start SmartPATH Printing."
echo " 4a. View SPOOL.LOG File."
echo " 5. Stop SmartPATH Printing."
echo ""
echo " E. Exit."
echo ""
echo " Please enter selection from above: \c"
read ANS

FLG=0
YN=""

if [ "$ANS" = "e" ]
then
ANS="E"

# elif [ "$ANS" = "b" ]
# then
# ANS="B"
fi

case $ANS in
1) echo "\nEnter yes to start the database servers: \c";;
2) echo "\nEnter yes to stop the database servers: \c";;
3) FLG=1;;
3a) echo "\nThe PAY2000 server MUST be running.";
echo "Enter yes to run conversion: \c";;
4) FLG=1;;
4a) FLG=1;;
5) FLG=1;;
E) exit;;
*) echo "\nInvalid selection, try again \007";
sleep 2;
FLG=9;;
esac

if [ "$FLG" = "0" ]
then
read YN
if [ "$YN" != "y" -a "$YN" != "ye" -a "$YN" != "yes" ]
then
FLG=9
echo "\nAction cancelled \007"
sleep 2
fi
fi


if [ "$FLG" != "9" ]
then
echo ""

case $ANS in
1) $SPAYSCR/spenv ./spserve;;
2) $SPAYSCR/spenv ./spshut;;
3) sh $SPAYSCR/spenv sh ./spsrved;;
3a) $SPAYSCR/spenv ./spsrvedcnv;;
4) $SPAYSCR/../spbatch.bat -p sp/dsp/objects/splstart.p;;
4a) echo "\nLast 10 lines of SPOOL.LOG file...\n";
tail /disk2/smartPAY/spserver/data/lg/spool.log;
echo "\nPress RETURN to continue\c";
read a;;
5) $SPAYSCR/../spbatch.bat -p sp/dsp/objects/splstop.p;;
esac
sleep 2
fi
done

exit


I get
command not foundserver.scripts/sp.con: line 1 :
invalid signal specificationpts/sp.con: line 2: trap: 15
/pylive/smartPAY/spserver/scripts/sp.con: line 6: cd: /pylive/smartPAY/spserver/: No such file or directory
/pylive/smartPAY/spserver/scripts/sp.con: line 38: syntax error near unexpected token `elif'
'pylive/smartPAY/spserver/scripts/sp.con: line 38: ` elif [ "$ANS" = "b" ]

etc

The point here is that when I enter the command from the command prompt it tries to run the file, but when the command comes from a script file it says that no such file or directory exists.

Also if there are any answers for the error messages I get from running sp.con directly I would appreciate them.

IT all worked in HP-UX, why not in Linux.

In answer to grail, I get
-rwxrwxrwx 1 dbadmin payroll 2378 Sep 29 16:12 /pylive/smartPAY/spserver/scripts/sp.con

Also I did run 'SU' so I was logged in as root.

Dave
 
Old 09-30-2010, 07:54 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Thanks .. gotta check everything sometimes

So my next question would be, what shell is controlling the script?

There should be a line at the top like:
Code:
#!/bin/bash
Or similar.
 
Old 09-30-2010, 09:29 AM   #6
davemaclurg
LQ Newbie
 
Registered: Sep 2010
Location: Perth, Scotland
Posts: 3

Original Poster
Rep: Reputation: 0
I don't have anything like "#!/bin/bash" at the head of the script files. Should I? Is this different from HP-UX?

Dave
 
Old 09-30-2010, 10:58 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Hi Dave

Unfortunately I am not very familiar with HP-UX, but under Linux you require an interpreter to understand what it is you wish to do in your script.

Looking at what is in your script I would think it is POSIX in nature so would suggest trying:
Code:
#!/bin/sh
A lot of systems have this linked to /bin/bash but it does seem to interpret differently.

Sorry I cannot be a bit more definitive
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mkdir : cannot create directory : no such file or directory patcheezy Linux - Newbie 6 05-13-2009 12:26 PM
Copying a single file into each directory of a directory tree mlapl1 Linux - Newbie 2 06-27-2007 11:18 PM
How to untar a file in another directory other then current directory. dr_zayus69 Linux - Software 8 05-16-2007 12:01 PM
Java File Processing using Scanner; Can't get it to read file in running directory xemous Programming 2 09-26-2006 07:13 PM
How to protect a file/directory in your home login directory (RH Linux) jitsenho Linux - Security 9 07-04-2006 12:08 AM


All times are GMT -5. The time now is 02:47 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration