Difference between revisions of "Step to rebuild crontab file of zimbra user"

m
 
(No difference)

Latest revision as of 10:49, 31 May 2019

Step to rebuild crontab file of zimbra user


   KB 23338        Last updated on 2019-05-31  




0.00
(0 votes)



Problem

  • Default crontab of zimbra user removed accidentally.
  • System admin removed some entries from the crontab file.


Solution

Steps to restore or rebuild crontab entries for the zimbra user on different ZCS environments.

(A) Steps for single-server setup:

First we have to take backup of current crontab file, then we will use following commands to rebuild crontab for zimbra user.

On ZCS v8.6:

cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  
cat /opt/zimbra/zimbramon/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.ldap >> /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.store >> /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.logger >> /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.mta >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra 
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 

On ZCS v8.7.x:

cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  
cat /opt/zimbra/conf/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.ldap >> /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.store >> /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.logger >> /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.mta >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra 
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 


(B) Steps for multi-server setup:

Here we have mentioned the commands according to the role of ZCS server.

On ZCS v8.6:

LDAP Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK 
cat /opt/zimbra/zimbramon/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.ldap >> /tmp/cron.zimbra  
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 
Mailbox Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK 
cat /opt/zimbra/zimbramon/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.store >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 
/etc/init.d/crond restart
MTA+Proxy Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  
cat /opt/zimbra/zimbramon/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/zimbramon/crontabs/crontab.mta >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra 
crontab -u zimbra /tmp/cron.zimbra   


On ZCS v8.7.x:

LDAP Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK 
cat /opt/zimbra/conf/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.ldap >> /tmp/cron.zimbra  
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 
Mailbox Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK 
cat /opt/zimbra/conf/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.store >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
crontab -u zimbra /tmp/cron.zimbra   
su - zimbra -c "zmschedulebackup -D" 
MTA+Proxy Server:
cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  
cat /opt/zimbra/conf/crontabs/crontab > /tmp/cron.zimbra
cat /opt/zimbra/conf/crontabs/crontab.mta >> /tmp/cron.zimbra
echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra 
crontab -u zimbra /tmp/cron.zimbra   


Note : We have to restart Cron service after installing new crontab file.

Commands to restart Cron service on different OS versions.

Ubuntu 12.04/14.04/16.04

service cron restart

RHEL/CentOS 7.x

systemctl restart crond

RHEL/CentOS 6.x

service crond restart


Submitted by: Heera Singh Koranga
Verified Against: ZCS 8.8, 8.7, 8.6 Date Created: 2017-08-23
Article ID: https://wiki.zimbra.com/index.php?title=Step_to_rebuild_crontab_file_of_zimbra_user Date Modified: 2019-05-31



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search