bin-utils/poc_service

21 lines
318 B
Plaintext
Raw Permalink Normal View History

2015-06-23 16:11:09 +00:00
#!/usr/bin/env bash
RUNAS="daemon"
sw_user(){
curr_user=$( id -un )
echo ">>> current user $curr_user"
if [ ! $curr_user = $RUNAS ]
then
echo ">>> wrong user"
echo ">>> commande $@"
sudo -nu $RUNAS $@
exit $?
fi
}
echo ">>> Args: $@"
sw_user $0 $@
echo "Running command as $( id -un ), with args: $@"