Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron job on web hosting with restrictions #1603

Closed
Bubka opened this issue Aug 11, 2018 · 17 comments
Closed

Cron job on web hosting with restrictions #1603

Bubka opened this issue Aug 11, 2018 · 17 comments
Labels
stale No replies or comments. Will be auto-closed in 14 days.

Comments

@Bubka
Copy link

Bubka commented Aug 11, 2018

I am running Firefly III version 4.7.5.1

Hello,

I use several recurring transactions so I need to set up the cron job. My firefly instance run on a web hosting on which I can set cron job but with some restrictions:

  • commands have to be embedded in a php file
  • jobs cannot be run every minute but every hour at best

Regarding the php file, is it possible to directly call one of the Laravel files instead of using the artisan cmdline?
Regarding the cycle, is it an issue to set hourly execution?

Thanks

@JC5
Copy link
Member

JC5 commented Aug 11, 2018

The cycle will probably not fire when you set it to every hour. I have a few cards to make this process easier because frankly, the tools provided by Laravel do not work. Firing up the entire site every minute is not very resource-friendly.

I hope to come up with a new cron job (next release, perhaps the one after that) that will only need to be fired once a day to work.

I am not sure if I can "embed" them in a PHP file, but there might be trick there as well.

@JC5 JC5 added this to Unplanned or far away in Firefly III roadmap Aug 11, 2018
@Bubka
Copy link
Author

Bubka commented Aug 11, 2018

Ok, thanks for the answer.

I have 20 recurring transactions so I would be very happy if i could get a workaround since you release a modified feature.

Is there a way to generate [a batch of] recurring transactions « manually », without the scheduler? i.e using another artisan command or one of the API end-point.

@JC5
Copy link
Member

JC5 commented Aug 11, 2018

No there's nothing else available yet. I've focused on releasing the actual feature first. I'm afraid they'll have to wait a bit before they can be fired.

@Bubka
Copy link
Author

Bubka commented Aug 11, 2018

Just for the record : i don’t expect the solution to come from you, i am willing to code something (i know php) if necessary. I just need some advise|help to identify a way to get a workaround.

@JC5
Copy link
Member

JC5 commented Aug 11, 2018

c465d1c

This is all the code you need. If you place at this exact spot, you can do curl http://your-firefly/login once a day and the recurring transactions will be created.

You can even make a IFTTT recipe out of it.

@JC5 JC5 added the question label Aug 12, 2018
@Bubka
Copy link
Author

Bubka commented Aug 12, 2018

Thanks for the hack James 👍

@JC5
Copy link
Member

JC5 commented Aug 12, 2018

No problem. I'm working on a special URL that does the same. The only difference will be that it requires the "command line token" from /profile to work. It'll be mentioned in the next changelog, so keep an eye out for it.

@stale
Copy link

stale bot commented Aug 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No replies or comments. Will be auto-closed in 14 days. label Aug 26, 2018
@JC5
Copy link
Member

JC5 commented Sep 1, 2018

The new release has a better cron job function:

https://firefly-iii.readthedocs.io/en/latest/installation/cronjob.html

@JC5 JC5 closed this as completed Sep 1, 2018
@Bubka
Copy link
Author

Bubka commented Sep 4, 2018

Hi James,
Thanks for the head up.

The new dedicated url /cron/run/<token> is great, i was able to set my cron job on my webhosting while it has restricted capabilities.

Just a question: the curl command returns me a webpage saying i don't have permission to access https://<myWebsite>/cron/run/<myToken>

Is it the expected behaviour ? Does it trigger recurring transactions anyway ?
If I open the cron url in my browser (being authenticated) the response in different, something like

Recurring transactions have been created successfully

@JC5
Copy link
Member

JC5 commented Sep 4, 2018

There's no difference from Firefly III's perspective. I've tested it and curl seems to work.

Perhaps your webserver blocks cURL requests. It's a common enough thing.

Try curl -A "Mozilla/5.0" <url> and see what it says.

@jinformatique
Copy link
Contributor

Hi James,

I'm running my FF3 locally. I just upgraded to 4.7.9. Whether I run the cronjob or the curl, I got the message:
The recurring transaction cron job did not fire.

curl http://localhost.home/firefly-iii/public/cron/run/32…
The recurring transaction cron job did not fire.%
curl -A "Mozilla/5.0" http://localhost.home/firefly-iii/public/cron/run/32…
The recurring transaction cron job did not fire.%
sudo /usr/bin/php /home/jean/web/firefly-iii/artisan firefly:cron
The recurring transaction cron job did not fire.
More feedback on the cron jobs can be found in the log files.

Which log files is it talking about? Because there is nothing new in firefly-iii/storage/logs

Debug information generated at 2019-01-29 12:08:46 UTC for Firefly III version 4.7.9.

Variable Content
FF version 4.7.9
FF API version 0.9.0
App environment local
App debug mode true
App cache driver file
App logging , daily
PHP version 7.2.10-0ubuntu0.18.04.1
Display errors Off
Session start 2019-01-01 00:00:00
Session end 2019-01-31 23:59:59
Session first 2018-01-01 00:00:00
Error reporting ALL errors
Host Linux
Interface apache2handler
UserID 1
Attempt at "en" false
Attempt at "English" false
Attempt at "en_US.utf8" 'en_US.utf8'
Attempt at "en_US.UTF-8" 'en_US.UTF-8'
DB drivers mysql, sqlite
Current driver sqlite
Login provider
Storage disks local-upload
Using Sandstorm? no
Is Sandstorm (.env) false
Is Docker (.env) false
bunq uses sandbox false
Trusted proxies (.env)
User agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Loaded extensions Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, apache2handler, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, intl, json, ldap, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache

@JC5
Copy link
Member

JC5 commented Jan 29, 2019

The job will not fire until there is something to do. I expect it will give you a response after about a day.

@jinformatique
Copy link
Contributor

Still, I runned it every other day and I got the same message:

The recurring transaction cron job fired successfully.
More feedback on the cron jobs can be found in the log files.

I have a recurring transaction set on the 1st and it did not fire.

@JC5
Copy link
Member

JC5 commented Feb 4, 2019

Wait, do you run it every day or do you skip a day?

@jinformatique
Copy link
Contributor

I run it manually some days when I thing about it. So by your question I guess that's not the way intended. I thought that it would catch up the transaction when the script did not run everyday.
I don't put on my laptop everyday with firefly locally installed on it. I have another PC for work.
Is there another way to fireup the recurring transaction manually?

Oops, sorry to have a particular use case not covered by the cron job.

@JC5
Copy link
Member

JC5 commented Feb 4, 2019

Sorry, Firefly III really needs a daily occurring cron job. I’ll think about a manual mode but I can’t give it a lot of priority I’m afraid.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale No replies or comments. Will be auto-closed in 14 days.
Projects
No open projects
Firefly III roadmap
Unplanned or far away
Development

No branches or pull requests

3 participants