HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

no file found running batch file

 
SOLVED
Go to solution
gobi_1
Frequent Advisor

no file found running batch file

hi been running batch file to copy file, but it prompts "no file found"

here the batch:
adddb.bat - cp /recital/userx.db /recital/users.db

adderic.bat - cp /recital/run/xusers.db /recital/run/users.db

thanks in advance
13 REPLIES
Ganesan R
Honored Contributor
Solution

Re: no file found running batch file

Hi Gobi,

Issue is not clear on your post. Could you elaborate the issue details?

Are you running any script to copy some files? if so provide the script contents?

Are you running any cron job?

I have heard batch files only on windows..
Best wishes,

Ganesh.
OldSchool
Honored Contributor

Re: no file found running batch file

"here the batch:
adddb.bat - cp /recital/userx.db /recital/users.db

adderic.bat - cp /recital/run/xusers.db /recital/run/users.db"

I take it the above are the names of 2 shell scripts and there contents.

the questions are:

1)which one are you actually running (or are you running a 3rd that is supposed to run the two above)?

2) how are you running whatever it is you are actually running?

-and-

3) what exactly does running it produce?
gobi_1
Frequent Advisor

Re: no file found running batch file

i have no cron jobs, i run this both for non root user to copy some files.
Ganesan R
Honored Contributor

Re: no file found running batch file

Hi Gopi,

adddb.bat - is this a batch file you are running?

and

cp /recital/userx.db /recital/users.db

is the batch file adddb.bat file contains only the above command?

Could you give us the batch file name you are running and contents of the batch file?
Best wishes,

Ganesh.
OldSchool
Honored Contributor

Re: no file found running batch file

On last try then ----

SO....

some file named "adddb.bat" contains the following:
cp /recital/userx.db /recital/users.db

---AND ---

some file named "adderic.bat" contains the following:
cp /recital/run/xusers.db /recital/run/users.db


IS THE ABOVE CORRECT???? A simply yes or no will suffice.

IF IT IS CORRECT, then:
1) at the command line, you type EXACTLY WHAT?
2) what EXACTLY, is the error message. not just FILE NOT FOUND.

I suspect its as simple as an issue with the "bat" files not in the PATH, but you insist on ignoring questions.

HINTS:
I) if it says "adddb.bat" or "adderic.bat" NOT FOUND, then the location of the bat file(s) aren't in your current path and you need to provide either:
a) the full path to it, or, if
b) if they reside in the current working directory, source them, as in
. ./adderic.bat (that's dot space dot slash)
c) modify the PATH to include the directory where they are located (but DON'T set it to ".")

II) If it says something like "cp ....FILE NOT" found, then file named in the script is not found where you think it should be.
gobi_1
Frequent Advisor

Re: no file found running batch file

here's the exact error message. users must go first to this directory and run the batch. I tried using root account but error still occur

root@SGCJMI[/disk1/eric]adddb.bat
sh: adddb.bat: not found.
root@SGCJMI[/disk1/eric]adderic.bat
sh: adderic.bat: not found.

Re: no file found running batch file

>users must go first to this directory and run the batch.
[/disk1/eric]adddb.bat
sh: adddb.bat: not found.

To execute a script, As OldSchool said, either:
1) This directory must be in $PATH.
2) You must use an absolute path: $PWD/adddb.bat
3) You must use ./adddb.bat
Steven Schweda
Honored Contributor

Re: no file found running batch file

> 2) You must use an absolute path: $PWD/adddb.bat
> 3) You must use ./adddb.bat

Actually, I believe:

2) You must specify a path to the script.
This can be an absolute path, like
/disk1/eric/adddb.bat
or a relative path, like:
./adddb.bat
or:
../eric/adddb.bat

(But something with a "/" in it.)

3) There is no "3)".


Note that when you show your actual commands
and error messages, instead of vague
descriptions, it's easy to spot the problem.

Re: no file found running batch file

>Steven: 2) You must specify a path to the script. 3) There is no "3)".

I was making it very simple and specific for a script in the current directory.
Suraj K Sankari
Honored Contributor

Re: no file found running batch file

HI,
root@SGCJMI[/disk1/eric]adddb.bat
sh: adddb.bat: not found.
root@SGCJMI[/disk1/eric]adderic.bat
sh: adderic.bat: not found.

As all said you have to give full path of the batch file.
check your file is physicly there or not
if yes then check for the execute permission.
if execute permission is there then you can run your batch program just give the batch name at the command prompt.
or else you have to run like this

root@SGCJMI[/disk1/eric]sh ./adddb.bat
root@SGCJMI[/disk1/eric]sh ./adderic.bat

Suraj
Steven Schweda
Honored Contributor

Re: no file found running batch file

> I was making it very simple [...]

3 is simpler than 2?

Things should be made as simple as possible,
but no simpler. Simple and False are
spelled differently for a reason.

"You can't do it" is very simple, too, but
it's not true, either.
gobi_1
Frequent Advisor

Re: no file found running batch file

thanks guys, run the absolute path and adjust the file permission & all works fine now

Re: no file found running batch file

>Steven: 3 is simpler than 2?

Maybe, there were lots of words in your revised 2). :-)