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

m
(Step to rebuild crontab file of zimbra user)
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
==Step to rebuild crontab file of zimbra user==  
 
==Step to rebuild crontab file of zimbra user==  
 
<hr>
 
<hr>
{{KB|{{ZC}}|{{ZCS 8.8}}|{{ZCS 8.7}}|{{ZCS 8.6}}|{{ZCS 8.5}}|}}  
+
{{KB|{{ZC}}|{{ZCS 8.8}}|{{ZCS 8.7}}|{{ZCS 8.6}}|{{ZCS 8.5}}|}}
{{WIP}}
 
 
 
 
 
  
 
==Problem==
 
==Problem==
Line 33: Line 30:
 
  su - zimbra -c "zmschedulebackup -D"  
 
  su - zimbra -c "zmschedulebackup -D"  
  
==== On ZCS v8.7.x: ====   
+
==== On ZCS v8.7.x and Above: ====   
 
  cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK   
 
  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 > /tmp/cron.zimbra
Line 42: Line 39:
 
  echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
 
  echo "# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART" >> /tmp/cron.zimbra  
 
  crontab -u zimbra /tmp/cron.zimbra   
 
  crontab -u zimbra /tmp/cron.zimbra   
  su - zimbra -c "zmschedulebackup -D"  
+
  su - zimbra -c "zmschedulebackup -D"
 
 
 
 
  
 
===(B)  Steps for multi-server setup: ===
 
===(B)  Steps for multi-server setup: ===
Line 76: Line 71:
  
 
   
 
   
==== On ZCS v8.7.x: ====   
+
==== On ZCS v8.7.x and Above: ====   
 
===== LDAP Server: =====
 
===== LDAP Server: =====
 
  cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  
 
  cp -pvr /var/spool/cron/zimbra  /tmp/zimbra.cron.BAK  

Latest revision as of 07:43, 23 May 2020

Step to rebuild crontab file of zimbra user


   KB 23338        Last updated on 2020-05-23  




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 and Above:

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 and Above:

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: 2020-05-23



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