The fix that was implemented in bluecherry server to stop bluecherry upgrades and installs from completely overwriting the root crontab file is still not working properly.
Although the install/upgrade process is now correctly placing the certbot cron commands in their own file in /etc/cron.d/certbot instead of in root’s crontab, the upgrade process is still corrupting the root crontab by deleting the top few lines, whatever they happen to be, and replacing them with two blank comment lines where each line only contains the hash character at the start.
At present, one has to fix up root’s crontab file everytime bluecherry is updated.
I deeply apologise for Bluecherry server upgrade corrupting your root crontab.
Thank you for bringing this to our attention.
I will implement the proper check which will at least prevent this logic from running again and again.
Other than that, I am not exactly sure how can the current code be “deleting the top few lines, whatever they happen to be, and replacing them with two blank comment lines”.
It does just crontab -l 2>/dev/null | grep -v 'bluecherry\|subdomainprovidercron' | crontab -, which
shouldn’t add anything (and my test confirms this)
deletes only lines matching bluecherry or subdomainprovidercron.
Are you on version 3.1.7 now?
Do you think your deleted crontab contents matched the above expressions?
Do you have an explanation how it could insert the blank comment lines?
I will keep looking into this.
That explains it, the search terms in your grep command are not specific enough and are finding any lines in the crontab that contain either the word “bluecherry” or " subdomainprovidercron"
My crontab just happens to contain the following lines at the top of the file:
#
# Backup the MariaDB bluecherry database prior to backing up the machine.
#
0 2 * * 0 /usr/local/bin/mysql-backup bluecherry > /tmp/mysql-backup.log 2>&1
Your grep command is finding the term “bluecherry” in the 2nd and 4th lines of the file and deleting them, leaving behind the two comment lines.
The two lines that you are really targeting, and which used to be in the root crontab, are: