Closed martin-josef closed 4 years ago
Hello,
hooks execution are contextualized in the environment specified by the where
key; thus in your example ./script.sh
will be searched on the remote server and specifically inside the configured wordpress_path
.
Wordmove does not have an automagic "upload and execute" mechanism.
Anyway you could:
.htaccess
there and deny access from the web to the folder or protect that folder in any other way you're confortable with)sudo bash /home/martin/script.sh
scp
your script execute it, and delete it all within the hook, e.g.:push:
after:
- command: 'scp ./script.sh user@host:/home/martin/'
where: local
- command: 'sudo bash /home/martin/script.sh'
where: remote
- command: 'rm -f /home/martin/script.sh'
where: remote
Just pointers, as you said, but I hope they could be of some help reasoning on the matter 😃
Dear Alessandro, that was super helpful, thanks. I have now simply added what I wanted to do to the movefile, it makes it a bit cluttered but that's ok for now.
Kind regards, Martin
Hey everyone,
I execute a few commands after pushing a site to make sure permissions etc. are correct. I would like to do some slightly more elaborate things, is it possible to execute a shell script I store locally — say, in the same folder as the local wordpress install — and execute that on the remote machine?
Pointers would be appreciated, thanks everyone.
From my movefile.yml: