I have a line
logger Ok
in my script. When I run it from command line with either of
./myscript.sh
sudo ./myscript.sh
sudo bash ./myscript.sh
it writes in log
Oct 17 22:32:01 d40688 mysqlf: Ok
I.e. it knows my username and doesn't think I am root.
While if I run this script from /var/spool/cron/root it writes
Oct 17 22:32:01 d40688 root: Ok
i.e. it thinks I am a root.
How to simulate latter run from command line?
sudo ./myscript.sh, temporarily addenv | grep SSHto get a hint. Readman sudo sudoers logger.