Radek
Radek

Reputation: 11091

sudoers syntax to run shell script as php user?

I want to run

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 

Upvotes: 0

Views: 1211

Answers (1)

zerkms
zerkms

Reputation: 254886

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`

Upvotes: 2

Related Questions