if su - myuser -c "$DIBIN" >>$LOGFILE 2>&1 &; then
The problem as I understand it is that my app cannot then access the variables, since they were set by root. My app, in C++, uses the getenv("LOGFILE") to check for the variable, which returns null.
I'm looking for a solution that involves the least amount of system configuration (ie., editing sudoers or bash profiles). Hopefully something can work right in the script. I'm thinking there should be a way that I can export variables for all users to read, but I don't quite understand the environment enough at this point.