sudoers syntax to run shell script as php user?
I want to run
- a shell script
restore - as postgres user
- from php script (the user name is
php) - using sudo 开发者_Python百科
the script will have few lines of code, something like
dropdb <database name>
psql -c "create database <database name> with encoding 'unicode';" -U edutemplate1
psql -d <database name> -f edu.hourly.sql
- what would be the sudo command syntax to run the script
restore - what would be the sudoers syntax to allow php user to run
restorescript aspostgresuser?
The command is absolutely the same as you do in console:
sudo -u db1inst1 /path/to/script.sh
Or even:
system('sudo -u db1inst1 /path/to/script.sh');
or
`sudo -u db1inst1 /path/to/script.sh`
加载中,请稍侯......
精彩评论