Well, it won't work the way you tried with . .bashrc because you're taking the .bashrc environment and then losing it when you sudo, but what seems odd is that you should still be picking it up when you take zimbra's shell but you're not (and I'm guessing you're just getting roots environment again). What shell does zimbra have (finger zimbra or grep zimbra /etc/passwd). Another thing you might try is creating a script like /usr/local/bin/restartzimbra.sh with the following:
Originally Posted by lzmarine
and then using your previous commandline like:
Really though, I'm not sure why you're passing through sudo when you're already root. Doing something like
sudo -u zimbra /usr/local/bin/restartzimbra.sh
Would be sufficient since you're root, and should definitely pick up zimbra's environment. Similarly, switching to user zimbra from root and making sure to get zimbra's environment would be:
su - zimbra -c "/opt/zimbra/bin/zmcontrol start"