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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -