4

Few days ago I added a cronjob using crontab -e which should run every 6 hours, however I noticed that cron job is not working. When I execute my script manually it works, and it should write some data to a file so I know if it works or not. In order to find what's wrong I executed this command: service cron status and I got this:

Redirecting to /bin/systemctl status  cron.service
● cron.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

When I execute service cron start then I get this:

Redirecting to /bin/systemctl start  cron.service
Failed to start cron.service: Unit cron.service failed to load: No such file or directory.

Can someone give me a hint what to do here, I'm not an expert on this.

Thanks

EDIT: Output from service crond status:

Redirecting to /bin/systemctl status  crond.service
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Pet 2016-05-13 13:46:20 EDT; 1 weeks 3 days ago
 Main PID: 26127 (crond)
   CGroup: /system.slice/crond.service
           └─26127 /usr/sbin/crond -n

Maj 13 13:46:20 host systemd[1]: Started Command Scheduler.
Maj 13 13:46:20 host systemd[1]: Starting Command Scheduler...
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 88% if used.)
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (running with inotify support)
Maj 13 13:46:20 host crond[26127]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Maj 17 13:49:01 host crond[26127]: (root) RELOAD (/var/spool/cron/root)
Maj 17 13:52:01 host crond[26127]: (mailman) RELOAD (/var/spool/cron/mailman)
Maj 24 10:06:01 host crond[26127]: (root) RELOAD (/var/spool/cron/root)

EDIT2:

Output from 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
2,58 * * * * /usr/local/bandmin/bandmin
0 0 * * * /usr/local/bandmin/ipaddrmap
46 13 * * * /usr/local/cpanel/scripts/upcp --cron
40 2 * * * /usr/local/cpanel/scripts/cpbackup
23 21 * * * /usr/local/cpanel/bin/backup
35 * * * * /usr/bin/test -x /usr/local/cpanel/bin/tail-check && /usr/local/cpanel/bin/tail-check
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
30 */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
37 4 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify
13,28,43,58 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1
19 4 * * * /usr/local/cpanel/3rdparty/bin/freshclam --quiet --no-warnings
0 */6 * * * /usr/bin/php /home/legacy/EssentricTools/src/index.php migrate:sync -c prod

My command is the last one

Alen
  • 229
  • 3
  • 4
  • 6
  • Are you really on Ubuntu? If yes, which version? What does `systemctl | grep cron` say? – Sven May 24 '16 at 14:17
  • Please copy&paste the output of the command `lsb_release -a;apt-get update; apt-cache policy cron` in https://paste.ubuntu.com/ and put the link in a comment – ob_dev May 24 '16 at 15:13
  • No, please don't it like that. Instead, do an `apt-get update` separately, and then **edit** the output of `lsb_release -a; apt-cache policy cron` into your post. @obounaim: If at all avoidable, don't put information pertinent to a question on outside resources that might vanish. – Sven May 24 '16 at 15:37
  • @Sven this is the output of your command: crond.service loaded active running Command Scheduler. Commands from obounaim are not found. This is clients server so I don't know which server is used, I assumed it's Ubuntu – Alen May 24 '16 at 15:40
  • 1
    Sorry, how can you not even know what OS you are on? The service is called `crond` on your system, which *might* be Fedora or EL7 (RHEL/CentOS), so please **edit** your post to include the output of service crond status`. – Sven May 24 '16 at 15:41
  • @Sven It's CentOS Linux release 7.2.1511 (Core) – Alen May 24 '16 at 15:44
  • @Alen Could you please update the question as requested by @Sven also add the output of the command `crontab -l` and highlight the line that you have added thanks – ob_dev May 24 '16 at 15:48
  • @obounaim It's updated – Alen May 24 '16 at 15:51

1 Answers1

-1

As not many info is being shown, I'll have to guess that there's a problem with permissions on the script that should be running, you configured the job wrong or you specified a wrong path.

If you don't want to test all of them and prefer the easy and fast way, read <user executing cron>'s local mail and you'll see the error.

sysfiend
  • 1,327
  • 1
  • 11
  • 24