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
gefragt vor 4 Monaten217 Aufrufe
2 Antworten
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
EXPERTE
beantwortet vor 4 Monaten
  • 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
EXPERTE
Steve_M
beantwortet vor 4 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen