I need cron runs every 5 mins

Discussion forum about Anuko Time Tracker
Post Reply
dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

I need cron runs every 5 mins

Post by dell810 » Tue Mar 13, 2018 7:32 am

Hi,
Is it possible to send a favorite report every 5 min from 7:00am to 9:00am, every day (Monday - Friday)?
cron notification: 0,05 * * * 1-5

I need cron runs every 5 mins
Thanks

wrc
Posts: 305
Joined: Tue May 25, 2010 8:30 pm

Re: I need cron runs every 5 mins

Post by wrc » Tue Mar 13, 2018 3:28 pm

dell810 wrote:Hi,
Is it possible to send a favorite report every 5 min from 7:00am to 9:00am, every day (Monday - Friday)?
cron notification: 0,05 * * * 1-5

I need cron runs every 5 mins
Thanks
There are 2 things to do.

1) Modify cron spec as so:

Code: Select all

0,5,10,15,20,25,30,35,40,45,50,55 7-8 * * 1-5
2) Makes sure that cron.php file in Time Tracker is called at least that often. Perhaps you want it to run every minute for testing. Once things are working, reduce frequency (and load) on your server to something more appropriate.

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Tue Mar 13, 2018 4:05 pm

Thanks for the answer
1. ok
2. Sorry, how can I do this?

wrc
Posts: 305
Joined: Tue May 25, 2010 8:30 pm

Re: I need cron runs every 5 mins

Post by wrc » Tue Mar 13, 2018 4:43 pm

See if this helps: https://www.anuko.com/time_tracker/user ... ations.htm

Basically, on the server that runs your Time Tracker, you need to configure a regular execution of cron.php file in the root directory of Time Tracker install.

If you use a Unix / Lunix like system, you can configure a cron program to do this. From that page above:
Processing occurs when cron.php script is executed. It compares tt_cron.next value with now and, if a report is due, sends it out and re-calculates its next run time. Therefore, timing accuracy actually depends on how often cron.php is called. To match cron spec precisely, you'll need to call it every minute but this will add unnecessary load on your server. Configure your timing wisely. We recommend hourly or even less frequent pings.

Below is an example of crontab entry to process notifications hourly at 5 minutes past each hour.

# timetracker ping to execute scheduled jobs
MAILTO=""
5 * * * * root /usr/bin/php /var/www/timetracker/cron.php
If you use a Windows box, you can try Task Scheduler.

If you don't have access to the server to accomplish the above, you can try accessing the cron.php page remotely, via an HTTP request, on regular intervals.

I hope it helps.

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Wed Mar 14, 2018 12:59 pm

Hi again,
I use a pc with windows 8 and xampp.
I added 2 notification (at notifications plugin):
0,5,10,15,20,25,30,35,40,45,50,55 7-9 * * 1-5 => every 5 min from 7:00am to 9:00am, every day (Monday - Friday)
0,5,10,15,20,25,30,35,40,45,50,55 14-16 * * 1-5 => every 5 min from 2:00mm to 4:00mm, every day (Monday - Friday)

I added 2 tasks at task scheduler:
7-9-5min.jpg
2-4-5min.jpg

but I do not receive any favorite reports
Pls can you check it?
Attachments
2-4-5min.JPG
2-4-5min.JPG (42.43 KiB) Viewed 6871 times
7-9-5min.JPG
7-9-5min.JPG (43.38 KiB) Viewed 6871 times

wrc
Posts: 305
Joined: Tue May 25, 2010 8:30 pm

Re: I need cron runs every 5 mins

Post by wrc » Wed Mar 14, 2018 2:06 pm

dell810 wrote:Hi again,
I use a pc with windows 8 and xampp.
Why Windows? I suggest trying a better, more secure, and free OS, such as Ubuntu or something else Linux based with a nice desktop UI, simply because of ongoing evil we are getting from Redmond for a long time now.

But if you insist on Windows, try to resolve the problem in steps.

1) Is your mail working? Try to send yourself a password reminder to confirm.

2) Is your notification in Time Tracker configured in a way that it sends out at least some reports? Try to use a browser and access your /cron.php page in browser, for example: http://localhost/timetracker/cron.php - this should output something. The following means no reports were sent:

Code: Select all

Done!
Additional strings before Done! indicate that some reports were sent and you should see them in the mailbox. Try this again after 5 minutes to see if the next report is sent as expected, and your cron configuration is correct. Assuming that all of the above works, proceed with step 3).

3) What exactly is your task action doing? You have not provided that screenshot and I suspect that this could be your problem. What happens if your execute that task manually in Task Scheduler? Nothing? The task action should access the cron.php URL to get the job done.

3.1) We need to create a script that does the polling (without Task Scheduler). Based on answer at https://stackoverflow.com/questions/470 ... edule-task
Locate the php.exe executable on your system and pass it the name of the script file using the -f parameter.

Example:

C:\Xampp\php\php.exe -f C:\Xampp\htdocs\timetracker\cron.php
Execute the command manually. Does it mail he report? If so, then the last step is to use this script as an action for your Task Scheduler job.

3.2) Configure task action in Task Scheduler to run the script. See if this helps https://www.digitalcitizen.life/advance ... -scheduler - the bottom section on this page has some pictures related to this.

I hope it helps.

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Fri Jul 03, 2020 10:14 am

Hi again after 2 years
Suddenly while TimeTacker was sending reports via email every day, now it doesn't send
I just tried to send a password reminder to confirm. (to check if my mail is working)
=> message: "Error sending mail. Use MAIL_SMTP_DEBUG for diagnostics."

I read about Troubleshooting Mail ->There are a few things to check if mail is not working.
Use MAIL_SMTP_DEBUG. For this, uncomment the define('MAIL_SMTP_DEBUG', 'true'); line in config.php.
Examine PHP errors. They can be printed on a page or in web server error log.
See mail server logs for additional error information.

The result is:
DEBUG: Recv: 220 ESMTP DEBUG: Send: EHLO localhost DEBUG: Recv: 250-hydra.otenet.gr DEBUG: Recv: 250-PIPELINING DEBUG: Recv: 250-SIZE 41100000 DEBUG: Recv: 250-ETRN DEBUG: Recv: 250-STARTTLS DEBUG: Recv: 250-AUTH PLAIN LOGIN DEBUG: Recv: 250-AUTH=PLAIN LOGIN DEBUG: Recv: 250-ENHANCEDSTATUSCODES DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250 DSN DEBUG: Send: MAIL FROM: DEBUG: Recv: 250 2.1.0 Ok DEBUG: Send: RCPT TO: DEBUG: Recv: 250 2.1.5 Ok DEBUG: Send: DATA DEBUG: Recv: 354 End data with . DEBUG: Send: From: "e-Attendance" To: dell810@mydomain.gr Subject: =?UTF-8?B?zpHOr8+EzrfOvM6xIM61z4DOsc69zrHPhs6/z4HOrCDOus+JzrTOuc66zr/PjQ==?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: BASE64 DEBUG: Send: zpHOs86xz4DOt8+Ezq0gz4fPgc6uz4PPhM63LAoKIM+AzrnOuM6xzr3Pjs+CIM62zrfPhM6uz4PO sc+EzrUgzrXPgM6xzr3Osc+Gzr/Pgc6sIM+Ezr/PhSDOus+JzrTOuc66zr/PjSDPg86xz4IuIAoK IM6gzrHPhM6uz4PPhM61IM+Dz4TOv869IM6xzrrPjM67zr/Phc64zr8gz4PPjc69zrTOtc+DzrzO vyDOs865zrEgzrXPgM6xzr3Osc+Gzr/Pgc6sIM+Ezr/PhSDOus+JzrTOuc66zr/PjSDPg86xz4Iu CgpodHRwOi8vMTAuMTYwLjEyMC4yNDAvcGFyL3Bhc3N3b3JkX2NoYW5nZS5waHA/cmVmPWY5Y2Uz NmIxMjJiYmQzZGQ1NDJhY2Q3ZDI3NzZjMzcyCgoKCiDOnM61IM61zrrPhM6vzrzOt8+DzrcKCiDO nc+Ezq3OvM6/z4Igzp3Or866zr/PgiB8IDI2NTEzIDYwMzE2 DEBUG: Send: . DEBUG: Recv: 554 5.7.0 Reject, id=25759-06 - SPAM Invalid response code received from serverDEBUG: Send: RSET DEBUG: Recv: 250 2.0.0 Ok Failed to send data [SMTP: Invalid response code received from server (code: 554, response: 5.7.0 Reject, id=25759-06 - SPAM)]DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 Bye

but my knowledge does not allow me to understand what it means
Pls can you help me ?
Thanks

Nik
Posts: 503
Joined: Wed May 26, 2010 5:55 pm

Re: I need cron runs every 5 mins

Post by Nik » Fri Jul 03, 2020 12:16 pm

dell810 wrote:
Fri Jul 03, 2020 10:14 am
Failed to send data [SMTP: Invalid response code received from server (code: 554, response: 5.7.0 Reject, id=25759-06 - SPAM)]DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 Bye
It looks like your SMTP mail server no longer accepts messages sent by your Time Tracker system. Rejects as spam. Contact mail server admins to fix this.

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Fri Jul 03, 2020 1:50 pm

I use eparapd@gmail.com and it works normally and sends and receives.
It doesn't just work with TimeTracker
I also tried Yahoo email but again it doesn't send reports
How can I fix it?

Nik
Posts: 503
Joined: Wed May 26, 2010 5:55 pm

Re: I need cron runs every 5 mins

Post by Nik » Fri Jul 03, 2020 3:02 pm

dell810 wrote:
Fri Jul 03, 2020 1:50 pm
How can I fix it?
See above. Contact your mail server admins. The problem has nothing to do with Time Tracker, your mail server rejects emais sent by the system where Time Tracker runs. You need to figure out why they are doing it and if they cannot fix it, perhaps use another SMTP mail server that does not block TT emails. Another option is to use Anuko-hosted Time Tracker.

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Mon Jul 06, 2020 4:51 am

Thank you for the instructions
Different approach instead of mail server:
The installation of t is local to PC in the office (localhost). Can reports created every 5 minutes, instead of being sent to the email, be stored locally on the PC as pdf files?
Thanks

dell810
Posts: 46
Joined: Sat Oct 01, 2016 1:09 pm

Re: I need cron runs every 5 mins

Post by dell810 » Fri Jul 10, 2020 7:32 am

Hi,
Is it possible not to send the favorite report as pdf file via email, but save the files (pdf) locally to the PC ?
Thanks a lot

admin
Posts: 561
Joined: Fri Oct 08, 2004 9:46 pm
Location: Vancouver, Canada
Contact:

Re: I need cron runs every 5 mins

Post by admin » Fri Jul 17, 2020 2:30 pm

dell810 wrote:
Fri Jul 10, 2020 7:32 am
Hi,
Is it possible not to send the favorite report as pdf file via email, but save the files (pdf) locally to the PC ?
Thanks a lot
You need to write a script for this. Your request looks similar to https://www.anuko.com/forum/viewtopic.php?f=4&t=2055 - there was someone at the thread willing to do the work for 100 euros, although the OP wanted CSV reports. PDF reports are not much different, IMHO. Perhaps, contact the freelancer to see if they are still available.

Post Reply