1 # suexec library script
3 if [ -z "${__suexec_sh_loaded}" ]
7 # exec a command via sudo/su
8 # Can be used to reexec this process under su/sudo, if run like this from
11 # suexec "${0}" "${@}"
13 # Specify target user name with -u as the first parameter
15 # suexec -u user "${0}" "${@}"
17 # Just as exec, this will replace the current process entirely, and will not
18 # return except upon error.
21 # Set name if user provided
29 if [ "$(id -un)" != "${user}" ]
33 [ -x "$(which sudo 2>/dev/null)" ] || cmd="su ${user} -c"