mkoko

Registered
Jan 18, 2020
4
0
1
Poland
cPanel Access Level
Root Administrator
Hello everybody,

I have removed the crontab of the root user by accident. It is difficult for me to restore it from backup (in our ovh hosting environment we have only a snapshot feature, which allows me to restore the entire system, but I cannot access a specific file).

How can I repair crontab so that essential features of WHM/CPanel continue to work as expected, e.g. AutoSSL, auto update etc?

Perhaps can someone please post their crontab?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,275
313
Houston
The crontab and it's permissions are as follows:

Code:
[[email protected] ~]# stat /var/spool/cron/root
  File: ‘/var/spool/cron/root’
  Size: 1517          Blocks: 8          IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 394113      Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-20 05:17:33.840072975 -0600
Modify: 2020-01-07 05:22:54.801632503 -0600
Change: 2020-01-07 05:22:54.801632503 -0600
 Birth: -
 

mkoko

Registered
Jan 18, 2020
4
0
1
Poland
cPanel Access Level
Root Administrator
The crontab and it's permissions are as follows:

Code:
[[email protected] ~]# stat /var/spool/cron/root
  File: ‘/var/spool/cron/root’
  Size: 1517          Blocks: 8          IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 394113      Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-01-20 05:17:33.840072975 -0600
Modify: 2020-01-07 05:22:54.801632503 -0600
Change: 2020-01-07 05:22:54.801632503 -0600
Birth: -
Ok, thank you. Clearly, I don't have this file. However, I still need the content to recreate it. Perhaps, I need to run some whm/cpanel script which does that? Would upgrading to a newer version of whm recreate the file? Unfortunately, I already have the newest version running...
 

mkoko

Registered
Jan 18, 2020
4
0
1
Poland
cPanel Access Level
Root Administrator
I have found this pretty old topic: What are these lines doing in /var/spool/cron/root?

Someone asks what are the root's crontab entries for and lists their crontab. I wonder whether I could safely copy these entries to my crontab? The post is really old (over 16 years old), so I'm a bit hesistant and I doubt whether they are correct and whether these are all which are required for the current version of whm/cpanel...

I would really appreciate if someone could just post the contents of the /var/spool/cron/root file for a standard whm installation.
 

quietFinn

Well-Known Member
Feb 4, 2006
1,477
224
193
Finland
cPanel Access Level
Root Administrator
Ok, thank you. Clearly, I don't have this file. However, I still need the content to recreate it. Perhaps, I need to run some whm/cpanel script which does that? Would upgrading to a newer version of whm recreate the file? Unfortunately, I already have the newest version running...
You can run:
Code:
/scripts/upcp --force
I don't know if it restores your crontab but no harm done if you run it.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,275
313
Houston
Hello,

I'm aware you don't have it, which is why I provided you the stat of the file which includes everything you'd need to recreate it.

This provides you with the path, permissions, and ownership in order to recreate it.
If you're not sure how to create the file it's just:

Code:
touch /var/spool/cron/root
A cPanel update should auto-populate it once more but default root cron jobs are as follows:

Code:
[[email protected] config]# crontab -l
0 6 * * * /usr/local/cpanel/scripts/exim_tidydb > /dev/null 2>&1
30 5 * * * /usr/local/cpanel/scripts/optimize_eximstats > /dev/null 2>&1
@reboot /usr/local/cpanel/bin/onboot_handler
8 0 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify
17 5 * * * (/usr/local/cpanel/scripts/fix-cpanel-perl; /usr/local/cpanel/scripts/upcp --cron > /dev/null)
0 1 * * * /usr/local/cpanel/scripts/cpbackup
0 2 * * * /usr/local/cpanel/bin/backup
35 * * * * /usr/bin/test -x /usr/local/cpanel/bin/tail-check && /usr/local/cpanel/bin/tail-check
0 */2 * * * /usr/local/cpanel/scripts/shrink_modsec_ip_database -x 2>&1
5,20,35,50 * * * * /usr/local/cpanel/scripts/eximstats_spam_check 2>&1
45 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_mailman_cache && /usr/local/cpanel/scripts/update_mailman_cache
30 */4 * * * /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
25 */2 * * * /usr/local/cpanel/bin/mysqluserstore >/dev/null 2>&1
15 */2 * * * /usr/local/cpanel/bin/dbindex >/dev/null 2>&1
15 */6 * * * /usr/local/cpanel/scripts/autorepair recoverymgmt >/dev/null 2>&1
*/5 * * * * /usr/local/cpanel/scripts/dcpumon-wrapper >/dev/null 2>&1
14,29,44,59 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1
4 0 * * * /usr/local/cpanel/3rdparty/bin/freshclam --quiet --no-warnings
22 22 * * 7 /usr/local/cpanel/scripts/send_api_notifications > /dev/null 2>&1
09,39 * * * * /usr/local/cpanel/scripts/clean_user_php_sessions > /dev/null 2>&1