Page 1 of 1
Cron job errors
Posted: Sat Mar 30, 2019 1:47 pm
by fvteamsports
I can not get the crontab to work. This is what I have in crontab -e but it will not perform a maint job.
* * * * * su www-data -c "/usr/bin/php /usr/share/timetrex/html/maint/cron.p$
I tried changing users in the above string and also "chown" the directories to every combination I can think of.
I can manually get the jobs to run with 15 of 17 jobs performed and get that red banner off timetrex by executing this:
sudo php /usr/share/timetrex/html/maint/cron.php
Any other command other than sudo creates an authorization failed.
Any ideas?
Timetrex version - 11.5.0
Ubuntu 18.04
php - 7.2
Postgres database
installed using deb package AFTER restoring the database from a windows machine, so it loaded as an upgrade.
Re: Cron job errors
Posted: Sat Mar 30, 2019 1:58 pm
by mikeb
The command you pasted here is cut-off at the end (notice the $), can you please paste the full and complete command that you are using?
If that is the full command, then that is likely your problem as its cut-off and missing the last part.
Re: Cron job errors
Posted: Wed Apr 03, 2019 11:51 am
by fvteamsports
Sorry about that, the cut and paste missed the end and I didn't catch it.
This is the full string in the crontab:
* * * * * su www-data -c "/usr/bin/php /usr/share/timetrex/html/maint/cron.php"> /dev/null$
( I have also tried editing that string in multiple ways with no luck, I even set times for it)
The only success I have had is running this manually:
sudo php /usr/share/timetrex/html/maint/cron.php
I'm assuming there is some type of permission issue or peer to peer conflict?
Re: Cron job errors
Posted: Wed Apr 03, 2019 11:55 am
by fvteamsports
Sorry screwed that one up also, here it is:
* * * * * su www-data -c "/usr/share/timetrex/html/maint/cron.php"> /dev/null$
Re: Cron job errors
Posted: Wed Apr 03, 2019 3:34 pm
by mikeb
There is still a "$" at the end, if that actually is in your crontab, then the command would fail as it shouldn't be there.
Re: Cron job errors
Posted: Thu Apr 04, 2019 11:09 am
by fvteamsports
Took the $ off and it still doesn't work.
Can you post an example to a string that is known to work?
Re: Cron job errors
Posted: Fri Apr 05, 2019 7:04 pm
by fvteamsports
Here is some more info. I can manually run the jobs but I get this output below.
user@timetrex:~$ sudo php /usr/share/timetrex/html/maint/cron.php
ERROR: Running as 'root' forbidden! To avoid permission conflicts, must run as the web-server user instead.
Example: su www-data -c "/usr/bin/php /usr/share/timetrex/html/maint/cron.php"
NOTE: Jobs are scheduled to run at specific times each day, therefore it is normal for only some jobs to be executed each time this file is run.
Jobs Executed: 17 of 17
Now I'll try what they suggested:
user@timetrex:~$ su www-data -c "/usr/bin/php /usr/share/timetrex/html/maint/cron.php"
Password:
su: Authentication failure
user@timetrex:~$
Re: Cron job errors
Posted: Sat Apr 06, 2019 10:40 am
by fvteamsports
Below are some more attempts:
NO LUCK:
user@timetrex:~$ su www-data -c "/usr/share/timetrex/html/maint/cron.php"
Password:
su: Authentication failure
NO LUCK:
user@timetrex:~$ su root -c "/usr/share/timetrex/html/maint/cron.php"
Password:
/usr/share/timetrex/html/maint/cron.php: line 1: ?php: No such file or directory
/usr/share/timetrex/html/maint/cron.php: line 2: /bin: Is a directory
/usr/share/timetrex/html/maint/cron.php: line 3: Desktop: command not found
/usr/share/timetrex/html/maint/cron.php: line 4: syntax error near unexpected token `('
/usr/share/timetrex/html/maint/cron.php: line 4: ` * TimeTrex Software Inc. Copyright (C) 2003 - 2018 TimeTrex Software Inc.'
NO LUCK:
user@timetrex:~$ su user -c "/usr/share/timetrex/html/maint/cron.php"
Password:
bash: /usr/share/timetrex/html/maint/cron.php: Permission denied
BUT THIS WORKS, sort of:
user@timetrex:~$ sudo php /usr/share/timetrex/html/maint/cron.php
ERROR: Running as 'root' forbidden! To avoid permission conflicts, must run as the web-server user instead.
Example: su www-data -c "/usr/bin/php /usr/share/timetrex/html/maint/cron.php"
NOTE: Jobs are scheduled to run at specific times each day, therefore it is normal for only some jobs to be executed each time this file is run.
Jobs Executed: 17 of 17
Is there anyone out there running timetrex on ubuntu 18 with working maint jobs running?
What permission should cron.php be set to?
Re: Cron job errors
Posted: Mon Apr 08, 2019 8:59 am
by mikeb
If you remove all lines from your crontab regarding TimeTrex, then in the TimeTrex directory run:
That should automatically add the proper cron command for you.
Re: Cron job errors
Posted: Mon Apr 08, 2019 10:34 am
by fvteamsports
That is what I needed! Seems to be working now.
Thank you.