LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Error when start zimbra by script (https://www.linuxquestions.org/questions/linux-server-73/error-when-start-zimbra-by-script-4175512689/)

jerrybu01 07-29-2014 11:45 PM

Error when start zimbra by script
 
i install zimbra mail zcs 8.0.6 on ubuntu server 12.04
i have a script to backup:
#!/bin/sh
DIR_SRC=/opt/zimbra
DIR_DST=/bkpZimbra
FILE="Backup_Zimbra_"`date +%Y%m%d%H%M%S`".tar.gz"

#stop zimbra
echo "Stop Zimbra service"
sudo -u zimbra /opt/zimbra/bin/zmcontrol stop

#stop pending zimbra process
echo "Kill other pending zimbra process"
ps auxww | awk '{print $1" "$2}' | grep zimbra | kill -9 `awk '{print $2}'`

#generate backup file
echo "Begin generate back up file. Waitting ....."
tar cpzf ${DIR_DST}/${FILE} ${DIR_SRC}
echo "Back up file done. "

#put backup an an ftp server
echo "Begin upload to FTP. Waitting"
curl -T ${DIR_DST}/${FILE} ftp://192.168.1.100 -u $USERNAME:$PASSWORD
echo "Upload back up file to FTP done"

#clean backup file
echo "Deleting uploaded file"
rm -f ${DIR_DST}/${FILE}
echo "Delete done"

#start zimbra
sudo -u zimbra /opt/zimbra/bin/zmcontrol start
echo "Back up done"

When th script start zimbra i have a problem with "logger" like this:
Host ubuntu.local
Starting ldap...Done.
Starting zmconfigd...Done.
Starting logger...Failed.
Starting logswatch...failed.


Starting mailbox...Done.
Starting antispam...Done.
Starting antivirus...Done.
Starting opendkim...Done.
Starting snmp...Done.
Starting spell...Done.
Starting mta...Done.
Starting stats...Done.

But when i start zimbra by command like this, it works. i don't understand to fix the problem above

root@ubuntu:~# su zimbra
zimbra@ubuntu:/root$ zmcontrol start
Host ubuntu.local
Starting zmconfigd...Done.
Starting logger...Done.
Starting mailbox...Done.
Starting antispam...Done.
Starting antivirus...Done.
Starting opendkim...Done.
Starting snmp...Done.
Starting spell...Done.
Starting mta...Done.
Starting stats...Done.

bathory 07-30-2014 12:11 PM

Hi,

Better use su instead of sudo in the stop/start zimbra commands. I.e replace:
Quote:

sudo -u zimbra /opt/zimbra/bin/zmcontrol stop
...
sudo -u zimbra /opt/zimbra/bin/zmcontrol start
with:
Code:

su - zimbra -c "/opt/zimbra/bin/zmcontrol stop"
...
su - zimbra -c "/opt/zimbra/bin/zmcontrol start"

Regards

jerrybu01 07-30-2014 07:41 PM

Quote:

Originally Posted by bathory (Post 5212052)
Hi,

Better use su instead of sudo in the stop/start zimbra commands. I.e replace:
with:
Code:

su - zimbra -c "/opt/zimbra/bin/zmcontrol stop"
...
su - zimbra -c "/opt/zimbra/bin/zmcontrol start"

Regards

I tried your code but the same error.
Error script:
.........
Host ubuntu.local
Starting ldap...Done.
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
Starting zmconfigd...Done.
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
Starting logger...Failed.
Starting logswatch...failed.


dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
Starting mailbox...Done.
Starting antispam...Done.
Starting antivirus...Done.
Starting opendkim...Failed.
opendkim: /opt/zimbra/conf/opendkim.conf: ldap://ubuntu.local:389/?DKIMSelector?sub?(DKIMIdentity=$d): dkimf_db_open(): Connect error
Failed to start opendkim: 0


Starting snmp...Done.
Starting spell...Done.
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
Starting mta...Done.
Starting stats...Done.

bathory 07-31-2014 01:24 AM

Quote:

dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
Huh, I don't know why zimbra wants to read that file.
I'm using this backup script on Centos and it works fine. Perhaps you could give it a try.


All times are GMT -5. The time now is 02:13 AM.