It has become necessary to set a hard path when performing actions by a script, namely:
There is a PHP file that updates the Web directory from a remote git repository. The problem is that the path it substitutes from the place where it was launched from.
Now in more detail. There are folders:
Remote origin:
/home/sdc/projects/one.git
/home/sdc/projects/two.git
Web directories:
/home/sdc/webpath/one
/home/sdc/webpath/two
/home/sdc/webpath/git.update/index.php
(the page that makesexec()
for theupdate.sh
script.update.sh
must be in theone
andtwo
folders)
Text update.sh
:
git pull origin master
So here. When exec
executed, I get an error that says that I am not in the git repository directory. That's right: since the path I see is the following: /home/sdc/webpath/git.update/
.
Question: How to substitute the program launch path from the directory where update.sh
is located? ( /home/sdc/webpath/one
or /home/sdc/webpath/two
).