I need to execute an install script using sudo, but towards the end of the script, the script needs to drop out of sudo and continue as the regular user.
su myscriptuser starts another shell in the name of myscriptuser and waits until it exits. Then it proceeds to run service myscript start in the name of root again.
What you need instead of the last 2 commands is sudo: