I have a simple very tiny web app, and wanted to make my life a bit easier by having a very simplistic deployment script, that does the following:
- Pull updates from git
- Run composer
- Change owner of all files
The script basically works fine and looks like this:
#!/bin/bash
echo "Updating repository ...";
sudo git pull;
echo "Installing composer dependencies from lockfile ...";
composer install;
echo "Changing owner to www-data:www-data ...";
sudo chown -R www-data:www-data .;
echo "Deployment DONE!";
However, as you can see, I have two commands run as sudo in this script. Nameply the git pull
and the chown
.
My problem is as follows: I am aware that there is a timeout for how often the system asks for my password when running commands with sudo. The problem is, that, even though I am well within the timeout, the script always asks for the password on the second sudo (chown) command.
Could someone please enlighten me, why that may be the case?
;
s, right? You just like it 'cause you're a Real C Programmer who eats pointers to pointers to pointers to pointers for breakfast? – cat May 07 '16 at 22:49