Cron job still running ever 30 mins after changing frequency

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Other
bnsupport ID: 778ff965-04aa-8654-6919-65c0bcc3b794
Description:
I have changed the frequency of a cron job, which was running every 30 minutes to run at 1am. I can see the change in sudo crontab -e and just crontab -e but the job still runs every 30 minutes.

Would be grateful for some help on this please.

Hi @anthony.brady,

that’s a custom cron job you included in the installation right? I can see that you set 0 1 * * * when defining the cron job so it should only work at 1am as you mentioned. Where did you see that it’s running every 30 minutes?

I can also see that you have duplicated content in the cron configuration, please review it

sudo crontab -l 
sudo crontab -l -u bitnami

Happy to help!


Was my answer helpful? Click on :heart:

Hello

That job was originally scheduled to run every 30 minutes, I changed it to rum at 1am every night. It is still running every 30 minutes.

Hi @anthony.brady,

Could you please let us know where did you see that it’s running every 30 minutes?

Did you check this? Apart from that, did you add something to the /etc/crontab file?

It updates a file and I can see the file is being modified every 30 minutes.

I didn’t add anything to the /etc/crontab file.

Hi @anthony.brady,

If you edited the cron job using the crontab command, everything should work as expected. However, you can try to reset the cron service. You can get more information from here.

https://stackoverflow.com/questions/10193788/restarting-cron-after-changing-crontab-file

I will give that a try but I did restart the server to try and reload it.

That didn’t work, file being uopdated every 30 mins still

Hi @anthony.brady,

I do not know if your custom PHP application is updating that file automatically or if you have any other service in the installation that is making that file change but the crontab configuration seems fine. I understand this request (https://www.DOMAIN.co.uk/search_cache.php ) updates the file, right? Do you have a cron job in any other remote machine that is making the request to the server?

Just looking at the access logs and it seems to be running from an external source:

52.56.202.54 - - [26/Apr/2021:06:30:01 +0100] “GET /search_cache.php HTTP/1.1” 200 -
52.56.202.54 - - [26/Apr/2021:06:30:01 +0100] “GET /search_cache.php HTTP/1.1” 200 66269
94.136.42.146 - - [26/Apr/2021:06:30:04 +0100] “GET /search_cache.php HTTP/1.1” 200 155632

I have no idea how this is happening.

Hi @anthony.brady,

Could you run the bnsupport tool again? Something seems to have gone wrong with the previous upload.

Regards,
Michiel

I have run the support tool again:

7aa5e6ab-8f27-c184-02cc-83d5bd6502c7

Hi @anthony.brady,

Do you recognize those IPs? Maybe there is a bot/attacker accessing your site and you think that there is a cron job running in your computer that is editing the file. Please take a look at this guide

https://docs.bitnami.com/aws/infrastructure/lamp/troubleshooting/deny-connections-bots-apache/

Thanks for that, I have blocked those IPs and the job didn’t run. I will see if the job runs on my scheduled time at 1am.

It was like my cron job that used to be every 30 minutes was replicated on external servers, I didn’t do this. Is it possible for an external source to read my cron jobs?

Hi @anthony.brady,

No, that’s not possible because if they read your cron jobs, they have access to the entire machine. That’s probably a bot that found your site and it’s requesting it from time to time. If you block them, everything should be fine.