centos - Spawning background process under different user in bash -
i know can run command spawn background process , pid:
pid=`$script > /dev/null 2>&1 & echo $!`
and run command under different user:
su - $user -c "$command"
i don't want script run root , can't quite figure out how combine 2 , pid of spawned process.
thanks!
i think want runuser
command. general syntax:
runuser -l usernamehere -c 'command'
i suspect if set $script variable above (with appropriate changes), first command want.
Comments
Post a Comment