postgres fails on reboot after successful install

Ask your questions regarding TimeTrex installation here.
Locked
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

postgres fails on reboot after successful install

Post by MickG01 »

Further to an earlier topic I installed on Ubuntu using the 3.0.8 auto installer since my mysql database was deemed unsuitable.

The installation was to /var/www/TimeTrex all installed and started OK and I was able to initialize the company and log in filling in user and company details. I was even able to start setting up employees etc. The pages used were all http://localhost:8085/interface/Login.php etc. etc. I was even able to close the browser and restart it no problems, and connect using seamonkey.

Then I shut down the computer and restarted it and trying to connect to the Login screen at the above url I got a 404 error.

I changed to http://localhost/TimeTrex/timetrex/interface/Login.php including changing the timetrex.ini.php file to point to /TimeTrex/timetrex/interface instead of just /interface and got a message on a yellow background: "TimeTrex is unable to connect to its database, please make sure that the database has been started and is running."

I tried starting the database using: "./postgresql-8.4 start" in /etc/init.d to no avail. Similarly "/var/www/TimeTrex/postgresql/bin/postgres -D /var/www/TimeTrex/postgresql/data &" started a job saying the database was available but the same result.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: postgres fails on reboot after successful install

Post by shaunw »

During the installation procedure, near the end a README file appears explaining that you need to add the "start" script inside the TimeTrex installation directory to your system startup scripts (/etc/rc.d/rc.local usually) in order for TimeTrex to start automatically when you reboot.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: postgres fails on reboot after successful install

Post by MickG01 »

I have to figure that out but initially I just ran it manually in a terminal. I was subsequently able to connect but got this:
LOG: database system was shut down at 2010-04-08 12:22:37 EDT
/var/www/TimeTrex/postgresql/scripts/ctl.sh : postgresql started at port 5433
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
Syntax OK
(98)Address already in use: make_sock: could not bind to address [::]:8085
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8085
no listening sockets available, shutting down
Unable to open logs
/var/www/TimeTrex/apache2/scripts/ctl.sh : httpd could not be started

These look like issues that need attention!
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: postgres fails on reboot after successful install

Post by shaunw »

If you try to start TimeTrex when its already running you will see messages like that, normally its not a big deal. Try stopping it first, then starting it again, do you see the same messages?
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: postgres fails on reboot after successful install

Post by MickG01 »

$ : /var/www/TimeTrex$ /var/www/TimeTrex/stop
Syntax OK
/var/www/TimeTrex/apache2/scripts/ctl.sh : apache not running
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
/var/www/TimeTrex/postgresql/scripts/ctl.sh : postgresql stopped

$ :/var/www/TimeTrex$ /var/www/TimeTrex/start
LOG: database system was shut down at 2010-04-08 13:31:55 EDT
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
/var/www/TimeTrex/postgresql/scripts/ctl.sh : postgresql started at port 5433
Syntax OK
(98)Address already in use: make_sock: could not bind to address [::]:8085
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8085
no listening sockets available, shutting down
Unable to open logs
/var/www/TimeTrex/apache2/scripts/ctl.sh : httpd could not be started

------------------------------------------------------------------------------
Just started entering data but currently selecting TimeSheet>MyTimeSheet gives:
TimeTrex is unable to connect to its database, please make sure that the database has been started and is running.

I also get this selecting Wage for an employee in the employee list: -> http://localhost:8085/interface/users/U ... search_id=
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: postgres fails on reboot after successful install

Post by shaunw »

It sounds like you have another process using port 8085, so TimeTrex's version of Apache can't use it. It could be that you have two conflicting installations of TimeTrex doing this, or just a rogue Apache process that wasn't able to quit. Try rebooting and seeing the the start/stop scripts work without complaining about the address already in use. (I recommend running "stop" first to confirm everything is shutdown before running "start" as a test)

This could also be the cause of the database connection issues, or it could be a caching issue and conflicting permissions with your cache files. I recommend clearing out your TimeTrex cache directory to see if that helps.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: postgres fails on reboot after successful install

Post by MickG01 »

Pretty much working now except i get:
WARNING: TimeTrex maintenance jobs have not run in the last 48hours. Please contact your TimeTrex administrator immediately.

The crontab entry seems to not be working but the manual operation shows as this:

mick@mick-desktop:~su root -c "php /var/www/TimeTrex/timetrex/classes/modules/core/../../../maint/cron.php"
Password:
mick@mick-desktop:~$

Is there a way to get a log from is showing what is/is not happening?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: postgres fails on reboot after successful install

Post by shaunw »

There is a script in the TimeTrex directory called "install_cron" that is run during the installation process to setup cron for you. The command that you specified is definitely wrong and likely just corrupted your cache directory, so you will need to delete all the files/directories out of it to fix that.

As the same user that you used to install TimeTrex with (which should not have been "root", btw), if you type "crontab -e", you should see the proper command to run the TimeTrex maintenance jobs.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: postgres fails on reboot after successful install

Post by MickG01 »

The command in the crontab is:
su root -c "php /var/www/TimeTrex/timetrex/classes/modules/core/../../../maint/cron.php" > /dev/null 2>&1

I replaced with the line in the install_cron which seems to work. Thanks
Locked