jobbyphp / jobby

Manage all your cron jobs without modifying crontab. Handles locking, logging, error emails, and more.
https://packagist.org/packages/hellogerard/jobby
MIT License
1.05k stars 154 forks source link

Cronjob not being added. #9

Closed averybross closed 10 years ago

averybross commented 10 years ago

Here are my current settings. The "hello." is getting echoed out, so I know the code works and everything. I even did a "is_class()" on it.

screen shot 2014-02-22 at 11 15 25 pm

Oh, and when I ran the default jobby.php file, it crashed my server and all of my processes went into "D" state.

What's up with that? Do I need something on my server configured?

hellogerard commented 10 years ago

Rick, have you tried running a simple Hello World script under jobby? This may help you isolate the problem.

Don't know about the server crash. Have never seen that before. Doubt there's much in jobby that could do such a thing.

On Sunday, February 23, 2014, RickBross notifications@github.com wrote:

Here are my current settings. The "hello." is getting echoed out, so I know the code works and everything. I even did a "is_class()" on it.

[image: screen shot 2014-02-22 at 11 15 25 pm]https://f.cloud.github.com/assets/4257160/2239701/11966b12-9c4a-11e3-8072-2c550c2e7e83.png

Oh, and when I ran the default jobby.php file, it crashed my server and all of my processes went into "D" state.

What's up with that? Do I need something on my server configured?

Reply to this email directly or view it on GitHubhttps://github.com/hellogerard/jobby/issues/9 .

Sent from my mobile device.

averybross commented 10 years ago

Yeah. I put a mail() script under it. The cron your instructions say to add emailed me like 80 emails, haha. So it is working.

Is there anything server side I need to hook up? Does jobby have a config file that I didnt add info to?

On Sun, Feb 23, 2014 at 1:14 PM, Gerard Sychay notifications@github.comwrote:

Rick, have you tried running a simple Hello World script under jobby? This may help you isolate the problem.

Don't know about the server crash. Have never seen that before. Doubt there's much in jobby that could do such a thing.

On Sunday, February 23, 2014, RickBross notifications@github.com wrote:

Here are my current settings. The "hello." is getting echoed out, so I know the code works and everything. I even did a "is_class()" on it.

[image: screen shot 2014-02-22 at 11 15 25 pm]< https://f.cloud.github.com/assets/4257160/2239701/11966b12-9c4a-11e3-8072-2c550c2e7e83.png

Oh, and when I ran the default jobby.php file, it crashed my server and all of my processes went into "D" state.

What's up with that? Do I need something on my server configured?

Reply to this email directly or view it on GitHub< https://github.com/hellogerard/jobby/issues/9> .

Sent from my mobile device.

Reply to this email directly or view it on GitHubhttps://github.com/hellogerard/jobby/issues/9#issuecomment-35839925 .

averybross commented 10 years ago

http://sociallev.com/respond/jobby.php

On Sun, Feb 23, 2014 at 1:15 PM, Rick Bross rbross3@gmail.com wrote:

Yeah. I put a mail() script under it. The cron your instructions say to add emailed me like 80 emails, haha. So it is working.

Is there anything server side I need to hook up? Does jobby have a config file that I didnt add info to?

On Sun, Feb 23, 2014 at 1:14 PM, Gerard Sychay notifications@github.comwrote:

Rick, have you tried running a simple Hello World script under jobby? This may help you isolate the problem.

Don't know about the server crash. Have never seen that before. Doubt there's much in jobby that could do such a thing.

On Sunday, February 23, 2014, RickBross notifications@github.com wrote:

Here are my current settings. The "hello." is getting echoed out, so I know the code works and everything. I even did a "is_class()" on it.

[image: screen shot 2014-02-22 at 11 15 25 pm]< https://f.cloud.github.com/assets/4257160/2239701/11966b12-9c4a-11e3-8072-2c550c2e7e83.png

Oh, and when I ran the default jobby.php file, it crashed my server and all of my processes went into "D" state.

What's up with that? Do I need something on my server configured?

Reply to this email directly or view it on GitHub< https://github.com/hellogerard/jobby/issues/9> .

Sent from my mobile device.

Reply to this email directly or view it on GitHubhttps://github.com/hellogerard/jobby/issues/9#issuecomment-35839925 .

averybross commented 10 years ago

I am using BlueHost (cPanel), if that helps.

hellogerard commented 10 years ago

Nothing server side, other than the actual master cron job.

Looking at your screen shot, your paths look odd. Jobby is meant be run from the root of your project, not from a sub folder. And in don't see a "public_html" folder in the "respond" folder.

If your test script works, perhaps the problem is not in jobby but your cron job?

On Sunday, February 23, 2014, RickBross notifications@github.com wrote:

http://sociallev.com/respond/jobby.php

On Sun, Feb 23, 2014 at 1:15 PM, Rick Bross rbross3@gmail.com<javascript:_e(%7B%7D,'cvml','rbross3@gmail.com');> wrote:

Yeah. I put a mail() script under it. The cron your instructions say to add emailed me like 80 emails, haha. So it is working.

Is there anything server side I need to hook up? Does jobby have a config file that I didnt add info to?

On Sun, Feb 23, 2014 at 1:14 PM, Gerard Sychay notifications@github.com<javascript:_e(%7B%7D,'cvml','notifications@github.com'); wrote:

Rick, have you tried running a simple Hello World script under jobby? This may help you isolate the problem.

Don't know about the server crash. Have never seen that before. Doubt there's much in jobby that could do such a thing.

On Sunday, February 23, 2014, RickBross notifications@github.com<javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Here are my current settings. The "hello." is getting echoed out, so I know the code works and everything. I even did a "is_class()" on it.

[image: screen shot 2014-02-22 at 11 15 25 pm]<

https://f.cloud.github.com/assets/4257160/2239701/11966b12-9c4a-11e3-8072-2c550c2e7e83.png

Oh, and when I ran the default jobby.php file, it crashed my server and all of my processes went into "D" state.

What's up with that? Do I need something on my server configured?

Reply to this email directly or view it on GitHub< https://github.com/hellogerard/jobby/issues/9> .

Sent from my mobile device.

Reply to this email directly or view it on GitHub< https://github.com/hellogerard/jobby/issues/9#issuecomment-35839925> .

Reply to this email directly or view it on GitHubhttps://github.com/hellogerard/jobby/issues/9#issuecomment-35839971 .

Sent from my mobile device.

averybross commented 10 years ago

I thought that may be the problem, I changed it to:

cd / && cd home/brentst1/public_html/sociallev/respond/ && php jobby.php 1>> /dev/null 2>&1

before adding the mail() script. It works with that ^

averybross commented 10 years ago

I was getting one email per second until I removed the last-line mail() script and replaced it with echo "hello";

averybross commented 10 years ago

screen shot 2014-02-23 at 1 22 22 pm

averybross commented 10 years ago

Do I need SSH access enabled? A SSH Key, or username/login?

I am on a VPN if that helps.

hellogerard commented 10 years ago

Your master cron job should be (what you have):

cd / && cd home/brentst1/public_html/sociallev/respond/ && php jobby.php 1>> /dev/null 2>&1

and change the command field in your jobby add call to:

'command' => 'php testcron.php',

and change the output field to:

'output' => 'log.txt'

hellogerard commented 10 years ago

When I suggested writing a Hello World script, I meant to echo Hello World in your testcron,php, not in jobby.php. Then Hello World should appearin log.txt

averybross commented 10 years ago

Ah, let me try that when I get back home.

Is the output path relative to jobby.php or the server root?

Sent from my iPhone

On Feb 23, 2014, at 1:32 PM, Gerard Sychay notifications@github.com wrote:

When I suggested writing a Hello World script, I meant to echo Hello World in your testcron,php, not in jobby.php

— Reply to this email directly or view it on GitHub.

hellogerard commented 10 years ago

It's relative to jobby.php.

averybross commented 10 years ago

if log.txt does not exist, will it be created?

averybross commented 10 years ago

So, I followed your instructions above. But log.txt is still at 0 bytes. :/

Can you check my config: screen shot 2014-02-23 at 2 34 28 pm

hellogerard commented 10 years ago

It will be created, but only if the cron user has permissions to create a file in that directory. What happens if you just run php jobby.php from the respond folder?

averybross commented 10 years ago

I'm not sure what you mean by that? Effectively just going to http://sociallev.com/respond/jobby.php in the browser right?

I returned a string just before run() closes in src/Jobby.php and then in respond/jobby.php..

echo $jobby->run();

and that returned the string... so... I'm not sure what is going on.

Is there a way I can force permissions or check the permissions to write to log.txt?

averybross commented 10 years ago

Oh, I can SSH into the respond folder and do that, yes.

I get "hello" back.

screen shot 2014-02-23 at 2 57 55 pm

averybross commented 10 years ago

The same thing happens with testcron.php, I get Hello World dumped into my terminal.

averybross commented 10 years ago

And you say "cron user"... What do you mean by that?

Is there some credentials I am missing? or settings that I may be getting caught up on?

averybross commented 10 years ago

Oh, and I found these error logs in my /src/Jobby folder:

[23-Feb-2014 14:01:02 America/Denver] PHP Warning: require(/home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/vendor/autoload.php): failed to open stream: No such file or directory in /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php on line 269 [23-Feb-2014 14:01:02 America/Denver] PHP Fatal error: require(): Failed opening required '/home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/vendor/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php on line 269

^^ Line 269 reads:

require(dirname(dirname(__DIR__)) . '/vendor/autoload.php');

averybross commented 10 years ago

I changed line 269 to:

require(__DIR__.'/vendor/autoload.php')

and now my log.txt reads:

"Hello WorldHello World"

But only twice... and it's not adding more.

averybross commented 10 years ago

It kept causing errors with what I changed it to... Hmm.

I am now trying:

require('http://sociallev.com/respond/vendor/autoload.php');

and no errors are being spit out in an error_log within /src/Jobby anymore... but my txt file isnt being updated.

hellogerard commented 10 years ago

Look like jobby may not be installed on the server. SSH into the server and run php composer.phar install

averybross commented 10 years ago

I ran these commands from my /respond/ folder..

screen shot 2014-02-23 at 3 31 41 pm

averybross commented 10 years ago

Packagist says I need phpUnit for dev (which I really dont know what that even means)

Could I be missing it?

And do I have the right version of each of the packages?

hellogerard commented 10 years ago

No, you shouldn't need phpunit. And you shouldn't have to mess with the vendor/autoload line. Since you can run php jobby.php from the command line, the problem must be with your cron job.

There's something weird with your path. In your cron job you're going to /home/brentst1/public_html/sociallev/respond and in Filezilla, it looks like it's /sociallev/response.

Maybe try changing your cron job to:

cd /sociallev/respond/ && php jobby.php 1>> /dev/null 2>&1

averybross commented 10 years ago

I am not seeing where you see /sociallev/response

It is respond... screen shot 2014-02-23 at 4 14 41 pm

averybross commented 10 years ago

jobby.php IS being hit by the master cron...

When I add a mail() to jobby.php, I get like 200 emails.

averybross commented 10 years ago

And the only way I dont get an error at line 269 of BackgroundJob.php is if I set it to:

require('http://sociallev.com/respond/vendor/autoload.php');

hellogerard commented 10 years ago

Ah, I missed the point about mail. So I was getting confused with seeing hello vs the Hello World. Focus on running php jobby.php. You should see hello in your terminal (like you already showed), and log.txt should contain Hello World. I'm also assuming you're on at least PHP 5.3. Can't really think of anything off the top of my head, without digging into it myself.

averybross commented 10 years ago

I sent you an email.

hellogerard commented 10 years ago

This was an issue with BlueHost.