Pay Period Schedules not generating automatically

Topics brought up by the TimeTrex open source community.
Locked
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Pay Period Schedules not generating automatically

Post by gdecaires »

Hi,

We have several companies set up on one machine and all except one are running smoothly. The company in question is not generating pay period schedules automatically.

The cron jobs seem to be running fine for this installation. Also, when I run php AddPayPeriod.php from the maint folder the period is created.

Any help would be appreciated.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

You will need to follow the instructions located here:
http://forums.timetrex.com/viewtopic.php?f=6&t=89

To enable debugging mode so TimeTrex generate logs of what is going on.

Set the verbosity to 10 instead of 11 though.

Once this is done if you wait 24hrs and attach the logs we should be able to see whats going on. Its possible that the AddPayPeriod script got stuck and TimeTrex thinks its still running, so it won't run it again.
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Re: Pay Period Schedules not generating automatically

Post by gdecaires »

shaunw wrote:You will need to follow the instructions located here:
http://forums.timetrex.com/viewtopic.php?f=6&t=89

To enable debugging mode so TimeTrex generate logs of what is going on.

Set the verbosity to 10 instead of 11 though.

Once this is done if you wait 24hrs and attach the logs we should be able to see whats going on. Its possible that the AddPayPeriod script got stuck and TimeTrex thinks its still running, so it won't run it again.
This is the output from the log file. I've pasted the results of the cron job for the pay period schedule as it is supposed to happen. I don't see and error but the schedules are simply not being created automatically:

---------------[ Thu, 05 May 2011 23:59:02 -0400 (PID: 32761) ]---------------
---------------[ Fri, 06 May 2011 00:00:13 -0400 (PID: 317) ]---------------
DEBUG [206]: <b>[Function]()</b>: URI: /var/www/SandridgeTT/maint/cron.php<br>
DEBUG [208]: <b>[Function]()</b>: Production: 1<br>
DEBUG [374]: <b>CronJobFactory::isScheduledToRun()</b>: Checking if Cron Job is scheduled to run: AddPayPeriod<br>
DEBUG [382]: <b>CronJobFactory::isScheduledToRun()</b>: Epoch: 1304654400 - 06-May-11 12:00 AM AST<br>
DEBUG [388]: <b>CronJobFactory::isScheduledToRun()</b>: Day Of Week Matches: 5<br>
DEBUG [393]: <b>CronJobFactory::isScheduledToRun()</b>: Month Matches: 5<br>
DEBUG [398]: <b>CronJobFactory::isScheduledToRun()</b>: Day Of Month Matches: 5<br>
DEBUG [403]: <b>CronJobFactory::isScheduledToRun()</b>: Hour Matches: 5<br>
DEBUG [408]: <b>CronJobFactory::isScheduledToRun()</b>: FINAL - Minute Matches: 5<br>
DEBUG [413]: <b>CronJobFactory::isScheduledToRun()</b>: Last Run is Valid: 1304568060<br>
DEBUG [454]: <b>CronJobFactory::Execute()</b>: Job is NOT currently running, running now...<br>
DEBUG [94]: <b>Validator::inArrayKey()</b>: Key: 20<br>
DEBUG [711]: <b>Factory::StartTransaction()</b>: StartTransaction(): Transaction Count: 0 Trans Off: 0<br>
DEBUG [757]: <b>Factory::Save()</b>: Calling preSave()<br>
DEBUG [800]: <b>Factory::Save()</b>: Updating...<br>
DEBUG [625]: <b>Factory::getUpdateQuery()</b>: Update<br>
DEBUG [257]: <b>Validator::isDate()</b>: Raw Date: 1304654412 Converted Value: 1304654412<br>
DEBUG [656]: <b>Factory::getUpdateQuery()</b>: Data changed, set updated date: <br>
DEBUG [838]: <b>Factory::Save()</b>: Calling postSave()<br>
DEBUG [721]: <b>Factory::CommitTransaction()</b>: CommitTransaction(): Transaction Count: 1 Trans Off: 1<br>
DEBUG [460] Array: <b>CronJobFactory::Execute()</b>: Command RetCode: 1 Output:
<pre>
Array
(
)
</pre><br>
DEBUG [106]: <b>Validator::isNumeric()</b>: Value:1<br>
DEBUG [94]: <b>Validator::inArrayKey()</b>: Key: 500<br>
DEBUG [145]: <b>Validator::isLength()</b>: Value: cron Length: 4 Min: 2 Max: 250<br>
DEBUG [145]: <b>Validator::isLength()</b>: Value: Executing Cron Job: 1 Command: php /home/www/SandridgeTT/classes/modules/core/../../..//maint/AddPayPeriod.php Return Code: 1 Length: 125 Min: 2 Max: 2000<br>
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

DEBUG [145]: <b>Validator::isLength()</b>: Value: Executing Cron Job: 1 Command: php /home/www/SandridgeTT/classes/modules/core/../../..//maint/AddPayPeriod.php Return Code: 1 Length: 125 Min: 2 Max: 2000<br>
It appears that the command failed to run at all, Return Code: 1 means failure, 0 means success.

Are you getting any big red error messages at the top of each TimeTrex page complaining about maintenance jobs not running by chance?

This is the command that TimeTrex is trying to run:

Code: Select all

php /home/www/SandridgeTT/classes/modules/core/../../..//maint/AddPayPeriod.php
I'm going to guess that "php" does not exist in the PATH, so it can't be found. If you edit your timetrex.ini.php and specify the full path and file name of your PHP binary under the [path] section for the php_cli entry. It should look something like this:

Code: Select all

[path]
;Full path and name to the PHP CLI Binary
php_cli = /usr/bin/php
That should hopefully correct the issue.
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Re: Pay Period Schedules not generating automatically

Post by gdecaires »

This line:

php /home/www/SandridgeTT/classes/modules/core/../../..//maint/AddPayPeriod.php

is incorrect. The cron job is set up to run /var/www/SandridgeTT/classes/modules/core/../../..//maint/AddPayPeriod.php

but it is still trying to run at /home/www/.........

Do you know where this configuration is found so that I can change it?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

What is the exact command specified in cron?

In the TimeTrex.ini.php file, what is your PHP_CLI line set to?
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Re: Pay Period Schedules not generating automatically

Post by gdecaires »

Cron is set to run:

su www-data -c "/usr/bin/php /var/www/SandridgeTT/classes/modules/core/../../../maint/cron.php" > /dev/null 2>&1


my PHP_CLI is pointing to /var/lib/php5
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

Okay, how come your command in cron uses a different PHP binary than the one specified in the timetrex.ini.php file?

Which one is correct?
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Re: Pay Period Schedules not generating automatically

Post by gdecaires »

The different PHP command is not intentional but is a symbolic link to the /var/lib/php5 command. This however doesn't seem to be the issue as cron is not reporting an error running the php but rather an error running a php command that doesn't exist. The timetrex installation is in /var/www but somewhere along the way, the cronjob is trying to run a file contained in /home/www/ which doesn't exist. I'm trying to find out where this erroneous path would be.

Thanks again.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

What version/edition of TimeTrex are you using?
gdecaires
Posts: 27
Joined: Tue Mar 01, 2011 8:26 am

Re: Pay Period Schedules not generating automatically

Post by gdecaires »

We're using version 2.0.3 and it's the business edition
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: Pay Period Schedules not generating automatically

Post by shaunw »

Please email support@timetrex.com instead of using the forums for the Business Edition of TimeTrex, we are better equipped to help you that way and response times are much better.

Also, I would highly recommend upgrading to the latest version of TimeTrex (v3.6.0) as v2.X hasn't been supported for several years now and very soon there won't be an upgrade path at all.
Locked