I'm working with the edx open source code base and I'm putting together a dotfile to make it easier to perform various tasks on the server. I'm having trouble with the following bash function
edx-compile_assets() {
sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/edx-platform
paver update_assets cms --settings=aws
paver update_assets lms --settings=aws
}
When sudo -H -u edxapp bash
is run, the function halts and nothing happens, when I exit from that env, then the remaining functions execute not as the edxapp
user, but as a normal user, which causes the commands to fail.
So basically, it looks like sudo -H -u edxapp bash
starts a separate process, and when that process ends, the remainder of the function executes
I guess what I'm looking for is a simple
way to run commands as the edxapp user
which is activated with sudo -H -u edxapp bash
Any help is appreciated, thanks :)