Crons Dont work

0

Hi,, I am trying to run Crons on this Lightsail instance running LAMP,which is not working.

0 12 * * * wget -q -O- https://crm.slescom.com/cron/index

0 6 * * * /usr/bin/curl -sS https://crm.slescom.com/crmapi/cron.php >/dev/null 2>&1

I want the top crons to run every midnight 12, and the below to 6 AM Dubai,,

Can someone help me to see what is the issue,

  • in the console, I get 500 internal server error

Jayanga
asked 4 months ago206 views
2 Answers
0

Hello.

Can you confirm that cron.d is started with the command below?

systemctl status cron

Also, can you check cron logs with the command below?

journalctl -r -u cron
profile picture
EXPERT
answered 4 months ago
  • Will it be successful if I run the command normally in bash shell instead of cron?

  • Yes,.

    Last login: Fri Jan 5 04:38:36 2024 from 24.4.46.54 bitnami@ip-123-23-13-213:~$ systemctl status cron ● cron.service - Regular background program processing daemon Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2023-12-11 19:45:09 UTC; 3 weeks 3 days ago Docs: man:cron(8) Main PID: 565 (cron) Tasks: 1 (limit: 2311) Memory: 48.7M CPU: 8min 6.666s CGroup: /system.slice/cron.service └─565 /usr/sbin/cron -f

  • cron itself is active, so there seems to be no problem. Can you change the cron settings as below and check what is written in result.txt?

    0 12 * * * wget -q -O- https://crm.slescom.com/cron/index > /tmp/result.txt
    

    Also, please make sure that "wget ​​-q -O- https://crm.slescom.com/cron/index" etc. is executed by cron using the following command.

    journalctl -r -u cron
    
0

The commands are failing because crm.slescom.com doesn't resolve, and going up a level slescom.com isn't registered (a whois fails https://who.is/whois/slescom.com )

$ nslookup crm.slescom.com
Server:  dns.google
Address:  8.8.8.8

*** dns.google can't find crm.slescom.com: Non-existent domain

Double-check you have the correct URL.

Minor point, but if you want to run the command every day at midnight the crontab needs to be 0 0 * * * and not 0 12 * * * (this runs it at midday).

profile picture
EXPERT
Steve_M
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions