views:

90

answers:

5

How do I execute a script on ssh? I need to execute:

/scripts/makecpphp

So I have tried "run /scripts/makecpphp" but it didnt work. Any help would be greatly appreciate. I know for sure that that file exists there.

+1  A: 

If makecpphp is executable, you just need to type:

./scripts/makecpphp

Are you sure it's executable? Note that this does not just apply over ssh, but any time you are running programs via a linux command line.

Stephen
+2  A: 

If the script is on the remote machine:

ssh [email protected] /scripts/makecpphp

If it's on the local machine:

/scripts/makecpphp

Borealid
A: 

If it's executable, just do

/scripts/makecpphp

Otherwise you can do (replace $INTERPRETER by the used interpreter, eg bash, python,...)

$INTERPRETER /scripts/makecpphp
Job
A: 

First off, do you have the permission to execute it and is it executable?

Secondly, I don't believe you would use run. You'd cd to the directory and then type ./makecpphp

Greg
by some reason, ./makecpphp worked fine, while /makecpphp didnt. Excellent, thank you for the respond.
Godnessssssssss
You need to provide the full path to the executable. `.` is shorthand for "the current director". Therefore, `./makecpphp` will work while `/makecpphp` will not. Note that you should not have to cd to the directory, you could just run `./scripts/makecpphp`.
Stephen
@Stephen: I guess it's all about habits- while I know that the whole changing directory process is unnecessary, that's personally how I would do it.
Greg
@Greg Ditto, but it's not totally necessary, so it's worth noting.
Stephen
A: 

you need to have execute permission on the script.

chmod +x /scripts/makecpphp

then run

/scripts/makecpphp

L4ndo