Maintenance Jobs

Ask your questions regarding TimeTrex installation here.
Locked
dkarora
Posts: 22
Joined: Thu Oct 18, 2007 11:43 am

Maintenance Jobs

Post by dkarora »

I run the command as shown below to solve the maintenance jobs problem

but it gives me some error

su resnet -c "php /var/www/apache2-default/classes/modules/core/../../../maint/cron.php"
Password:


NOTE: Jobs are scheduled to run at specific times, therefore only some jobs are executed each time this file is run.
Jobs Executed: 0 of 10
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Are you running that command from your crontab on a regular basis?
dkarora
Posts: 22
Joined: Thu Oct 18, 2007 11:43 am

Post by dkarora »

What is a cron tab ??

I run it from the terminal it gave me that error
dkarora
Posts: 22
Joined: Thu Oct 18, 2007 11:43 am

Post by dkarora »

how to get to the cron tab ??

i dont know anything about the cron tab
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

NOTE: Jobs are scheduled to run at specific times, therefore only some jobs are executed each time this file is run.
Jobs Executed: 0 of 10
Thats not an error, its simply a notification that it is infact working correctly.

You can find a crontab howto on the internet if you search Google for: "crontab howto" or "crontab tutorial".

If you still have problems I would recommend looking into our installation support package, or using our binary installer which is available for Linux.
dkarora
Posts: 22
Joined: Thu Oct 18, 2007 11:43 am

Post by dkarora »

But it still gives me an error on the top that maintenance jobs havent been run for more than 48 hours

Why is it giving me that error ??
ssundquist
Posts: 12
Joined: Wed May 14, 2008 11:05 am
Location: Michigan
Contact:

Post by ssundquist »

I just replied to another post regarding cron jobs as well. More detailed instructions would be greatly appreciated. Thanks in advance!

-Shawn
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

The maintenance scripts (cron.php) need to be run every minute. This is what cron or the Windows Task Scheduler does when it is setup correctly.

During the TimeTrex installation procedure it explains how to setup cron properly. If you re-enable the installer in your timetrex.ini.php file, then point your web browser to:

/interface/install/MaintenanceJobs.php

You can see the instructions again.
ssundquist
Posts: 12
Joined: Wed May 14, 2008 11:05 am
Location: Michigan
Contact:

Post by ssundquist »

Thanks Shaun,

I was confused during the initial install, but going back and researching Ubuntu Crontab and looking at the maintenance.php file I think it's working. I'm no longer getting the "Maintenance job hasn't run in 48 hours" message. One thing maybe you could clarify... I put the line in crontab as * * * * *. Does this mean it will run every minute? Is this the preferred time setting?

-Shawn
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Yes, five "*"'s means it will run every minute as it should. It doesn't actually do anything every minute, but TimeTrex needs one minute timing resolution for future purposes, so thats the reason it runs so often. 99.9% of the time it just exits without doing anything.
PoopyTheJ
Posts: 10
Joined: Tue Jul 29, 2008 1:20 pm

Post by PoopyTheJ »

I don;t want to hijack but reading through this didn't help a lot. I'm running Ubuntu and trying to get the Maintenance jobs to run, I can't find a maintenance.php file so I can't follow what ssundquist did. When I run the cron.php from command line I get nothing returned I get what you see in the below screenshot, a blinking cursor. What am I doing wrong? I'm running the command su poopythej -c php /home/poopythej/TimeTrex/timetrex/maint/cron.php as that's where TimeTrex is installed to. Since I can't see anything occuring and I still get the Maintenance jobs haven't run in 48hrs command I'm loath to attempt to set it up in cron for fear of doing something wrong and I haven't found a good example of what it should look like in crontab once it's setup. Any information or advise would be wonderful, I need to demo this for the owner of the company and the HR staff next week and any help would be greatly appreciated.

Image[/img]
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

It looks like the command you ran didn't finish by the time you took the screenshot. The maintenance jobs can take quite a while to run if they haven't been run in several days, you should wait at least 10-15 minutes to see if they eventually finish.
PoopyTheJ
Posts: 10
Joined: Tue Jul 29, 2008 1:20 pm

Post by PoopyTheJ »

No never finished even the next day, however after modifying the path I got the command line to work using " su poopythej -c "php /home/poopythej/TimeTrex/timetrex/maint/cron.php""
I go some errors with things wrong like PHP_Magic_Quotes and PHP PEAR but I got those fixed now the command runs without error from the command line. I've entered the job into my crontab as well however I still recieve the big red box notifying me that maintenance jobs haven't run in 48hrs. Here is my crontab entry,

* * * * * su poopythej -c "php /home/poopythej/TimeTrex/timetrex/maint/cron.php"> /dev/null > 2 &1

How can I tell if crontab is running the cron.php job? Last time I ran cron.php manually I got this...

poopythej@poopythej-desktop:~$ su poopythej -c "php /home/poopythej/TimeTrex/timetrex/maint/cron.php"
Password:
NOTE: Jobs are scheduled to run at specific times, therefore only some jobs are executed each time this file is run.
Jobs Executed: 6 of 11


I'm assuming that given cron.php running regularly it should not be running 6 of 11 tasks but 0 tasks. How can I check if the job is running or not? I've recently migrated to linux as the owner of the company is interested in migrating to it and I have some experience with it so I've taken over the project but my experience in linux is very limited. I assume changing the null line will give me a log somewhere to read but what do I change it to and where is the log to be located?
PoopyTheJ
Posts: 10
Joined: Tue Jul 29, 2008 1:20 pm

Post by PoopyTheJ »

figured it out the crontab entry was wrong after adjusting it I'm getting mail with notifications of jobs run.

proper format of the crontab is this

* * * * * php /home/poopythej/TimeTrex/timetrex/maint/cron.php


not what I had earlier. All seems well though I still have the red box, how long till that'll go away if everything really is working correctly?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

The red warning message should disappear instantly in the latest versions of TimeTrex. Are you sure you are running the cron.php file as the same user that your web server is running as?

If they are different users this will cause you all kinds of problems, because they both need to read/write the same files and the permissions won't allow them to do so.
PoopyTheJ
Posts: 10
Joined: Tue Jul 29, 2008 1:20 pm

Post by PoopyTheJ »

Error is gone now, It must have just taken a couple of runs cause after the first run it was still there but getting on this morning it was gone. Now I just need to figure out why my schedules don;t seem to be actually notifying me if someone doesn't punch in or out. But that's another discussion.
Locked