Welcome Guest, Not a member yet? Register   Sign In
Where to set CI_ENV for CI methods executed via cron?
#1

I was delighted to learn that one can invoke CodeIgniter controller methods via CLI so I've constructed a variety of controller methods to handle jobs I want to run via cron. There's one big problem: cron doesn't read the CI_ENV that I added to my .bashrc file so I cannot set CI_ENV before my code starts executing.

I did find a workaround of sorts. Namely, you add the source ~/.bashrc command before each of my cronjobs:
Code:
* * * * * source ~/.bashrc; php /tmp/foo/foo.php

This is a complex project with perhaps a dozen cron jobs, so that's going to result in a LOT of extra junk in my crontab. Can someone suggest a better way?
Reply


Messages In This Thread
Where to set CI_ENV for CI methods executed via cron? - by sneakyimp - 04-10-2017, 07:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB