ftored's avatar

Cron job to wget page that loads info from Google Sheets

Hello,

I am implementing an app, that needs to check for data in a specific google sheet and am using the the Google's API and some laravel package to do so. The funcitonality is all there and now am just pondering on how to schedule this to run at specific hours on specific week days every 5 seconds.

What i did (and works) is to add some entries by using crontab -e which do the follwoing:

My question is regarding performance, is this a good way to do it? It is just a simple excel sheet with some values (around 100). The users are not many on the web app (around 20) . Would you recommend something different?

0 likes
4 replies
ftored's avatar

Thank you so much fo rboth answers,

@anthonyclark , i lloked into that, but what actually is the benefit of doing it like that instead of crontab? I guess i will handle the sleep in the 'inspire' command correctly? Actually in that command i will have a loop from 0 to 12, with a sleep duration of 5 and the call to the wget command?

@silencebringer , i will look into the package as it seems to do what i need to, without the need to use the sleep workaround for calling it after a specified seconds amount!

anthonyclark's avatar

@ftored yes, you would need to do the sleep within the command as it only runs every minute without the package suggested by @silencebringer

The benefit comes from having a single location for all your crons. Your crontab will have just one entry:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

All crons are managed through your codebase, usually in version control.

Please or to participate in this conversation.