Tiny Core Linux
Tiny Core Extensions => TCE Talk => Topic started by: jessethepro on February 18, 2013, 09:36:03 PM
-
Hi,
I am trying to run postgresql as a service. When run as user tc through ssh script:
PGDATA=/tmp/maxdb
pg_ctl init
/tmp/tcloop/postgresql/usr/local/bin/postgres -D /tmp/maxdb
Runs without issue.
When put into bootlocal.sh service doesn't start. Anyone have success starting postgres on boot as a service?
Respectfully,
Jesse
-
bootlocal.sh runs as root.
When you say ssh script did you perhaps mean sh script?
-
You also should not be referencing /tmp/tcloop/postgresql/
-
Hi jessethepro
I would also question your use of /tmp/tcloop. /tmp/tcloop/postgresql/usr/local/bin/postgres is linked to
/usr/local/bin/postgres and /usr/local/bin is in the path.
postgres -D /tmp/maxdb is all you need.
-
Thank you for the great info,
I log in through ssh and run the script with the default shell
I didn't know the path linked to /usr/local/bin. That is great to know.
Changing the start command to postgres -D /tmp/maxdb works perfect when run through the shell, but won't start when run through bootlocal.sh. If postgres is like mysql, it probably doesn't like being started by root. Is there a way to start a service by user tc through bootlocal.sh?
I tried putting:
echo -e "password for tc" | su tc
Before the postgres commands to switch users and run the last of bootlocal.sh.as user tc, but didn't have much luck with that.
Respectfully,
Jesse
-
Hi jessethepro
This same type of situation came up recently here:
http://forum.tinycorelinux.net/index.php/topic,14573.msg82686.html#msg82686
So maybe something like:
su tc -c 'postgres -D /tmp/maxdb'
will do what you need.
-
Rich,
The command you gave me worked perfectly. I do appreciate the assistance. For future reference, the complete script in bootlocal.sh to start the postgresql server with default unix sockets is:
export PGDATA=/tmp/maxdb #or any other file path for the database
su tc -c 'pg_ctl init'
su tc -c 'postgres -D /tmp/maxdb'
Thank you again for everyones assistance,
Jesse