Starting database server at bootup using rc.local question.

Starting database server at bootup using rc.local question.

Post by MattSta » Sun, 05 May 2002 03:30:43



Hi,

I need to start a PostgreSQL database server at Linux bootup, so I need
to add a line to the file '/etc/rc.d/rc.local'.

To manually start the postgresql server I would type the following line,
it is essential that the server is started with the owner as user
'postgres'.

su -c 'pg_ctl start -l /var/lib/pgsql/logs/serverlog
-D /var/lib/pgsql/data -o -i' postgres

How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

When this is working, how do I tell Linux to run the server shutdown
command (below) so it stops correctly when I shutdown/reboot?

su -c 'pg_ctl stop -D /var/lib/pgsql/data -m s' postgres

Or will the postgresql server shutdown safely and automatically when I
shutdown/reboot Linux?

Many thanks for your help, regards,

..matthew

PS. Linux version: RedHat 7.2, Kernel 2.4.7-10

 
 
 

Starting database server at bootup using rc.local question.

Post by davide_sp.. » Sun, 05 May 2002 03:50:47



Quote:> I need to start a PostgreSQL database server at Linux bootup, so I need
> to add a line to the file '/etc/rc.d/rc.local'.

I would make a script that accept start/stop, then I would call the
script with the correct parameter from rc.local or from one of the
many script that are run during system startup/shutdown.

If your distribution uses the SysV style, you should have many
directory in /etc/rc.d, one for every 'initlevel' of the system.
level 0 is shutdown and level 6 is reboot. Just link your script
in there and it will be called during reboot/shutdown. The same
happen for level 3.

If your distribution is more Bsd style, you should have a script
called rc.K in /etc/rc.d that is used to Kill all the application
before reboot/shutdown.

Quote:> How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

Leave it like it is, but be sure to specify the complete path of
every command.

Davide

 
 
 

Starting database server at bootup using rc.local question.

Post by ne.. » Sun, 05 May 2002 05:35:55



> Hi,

> I need to start a PostgreSQL database server at Linux bootup, so I need
> to add a line to the file '/etc/rc.d/rc.local'.

No you don't if you installed from rpms.

Quote:> To manually start the postgresql server I would type the following line,
> it is essential that the server is started with the owner as user
> 'postgres'.

> su -c 'pg_ctl start -l /var/lib/pgsql/logs/serverlog
> -D /var/lib/pgsql/data -o -i' postgres

> How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

Don't really know how this will switch users.

Quote:> When this is working, how do I tell Linux to run the server shutdown
> command (below) so it stops correctly when I shutdown/reboot?

> su -c 'pg_ctl stop -D /var/lib/pgsql/data -m s' postgres

> Or will the postgresql server shutdown safely and automatically when I
> shutdown/reboot Linux?

> Many thanks for your help, regards,

> ..matthew

> PS. Linux version: RedHat 7.2, Kernel 2.4.7-10

RH have done some really nice things. Like when you install
PostgresSQL from rpms all you need do as root is:

chkconfig --level 2345 postgresql on
service postgresql start

The first line will automagically start PostgreSQL at boot
and the second will start it immediately.

--
Registered Linux User # 125653 (http://counter.li.org)
Certified: 40% bastard, 22% of which is tard.
http://www.thespark.com/bastardtest

 
 
 

Starting database server at bootup using rc.local question.

Post by MattSta » Sun, 05 May 2002 07:18:08


Quote:> > I need to start a PostgreSQL database server at Linux bootup, so I need
> > to add a line to the file '/etc/rc.d/rc.local'.

> I would make a script that accept start/stop, then I would call the
> script with the correct parameter from rc.local or from one of the
> many script that are run during system startup/shutdown.

> If your distribution uses the SysV style, you should have many
> directory in /etc/rc.d, one for every 'initlevel' of the system.
> level 0 is shutdown and level 6 is reboot. Just link your script
> in there and it will be called during reboot/shutdown. The same
> happen for level 3.

> > How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

> Leave it like it is, but be sure to specify the complete path of
> every command.

Thanks Davide.

I'm using, Linux version: RedHat 7.2, Kernel 2.4.7-10.

I do have the multiple levels of /etc/rc.d/rc0.d to rc6.d. In every one
of those directories there is a file called 'K15postgresql' that is a
symbolic link to the script '/etc/rc.d/init.d/postgresql'. This file
seems to be some kind of comphrehensive postgresql script --but I am not
very familiar with the scripting language.

Why is this script linked from ALL the rc0.d ... rc6.d directories?

Despite the existence of the script the postgresql server does not start
on bootup even though the directories and paths, etc, in the script all
look correct. Why might this be?

Any help anyone can give me would be appreciated.

Thank's and regards,

..matthew

 
 
 

Starting database server at bootup using rc.local question.

Post by Mark LaPierr » Sun, 05 May 2002 09:39:38



>>>I need to start a PostgreSQL database server at Linux bootup, so I need
>>>to add a line to the file '/etc/rc.d/rc.local'.

>>I would make a script that accept start/stop, then I would call the
>>script with the correct parameter from rc.local or from one of the
>>many script that are run during system startup/shutdown.

>>If your distribution uses the SysV style, you should have many
>>directory in /etc/rc.d, one for every 'initlevel' of the system.
>>level 0 is shutdown and level 6 is reboot. Just link your script
>>in there and it will be called during reboot/shutdown. The same
>>happen for level 3.

>>>How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

>>Leave it like it is, but be sure to specify the complete path of
>>every command.

> Thanks Davide.

> I'm using, Linux version: RedHat 7.2, Kernel 2.4.7-10.

> I do have the multiple levels of /etc/rc.d/rc0.d to rc6.d. In every one
> of those directories there is a file called 'K15postgresql' that is a
> symbolic link to the script '/etc/rc.d/init.d/postgresql'. This file
> seems to be some kind of comphrehensive postgresql script --but I am not
> very familiar with the scripting language.

> Why is this script linked from ALL the rc0.d ... rc6.d directories?

> Despite the existence of the script the postgresql server does not start
> on bootup even though the directories and paths, etc, in the script all
> look correct. Why might this be?

> Any help anyone can give me would be appreciated.

> Thank's and regards,

> ..matthew

Now that one I can answer.  The sym links that start with K are used to Kill the
application when entering that run level.  If you want the application started
when you enter a run level you need to put a sym link in exactly like the one
that starts with the K but replace the K with an S and replace the numerical
part with a number that would make sense in the context of all the other
symlinks.  When the machine enters a run state it first processes all the K sym
links in order of their numerical part starting from 0 and going up.  When it
runs out of K's it starts with the S's in asending numerical order.  If the
application you want to start depends on other functions being up and running
you need to give it a higher number than the processes that must start before it
does.
 
 
 

Starting database server at bootup using rc.local question.

Post by ne.. » Mon, 06 May 2002 02:29:30



>> > I need to start a PostgreSQL database server at Linux bootup, so I need
>> > to add a line to the file '/etc/rc.d/rc.local'.

>> I would make a script that accept start/stop, then I would call the
>> script with the correct parameter from rc.local or from one of the
>> many script that are run during system startup/shutdown.

>> If your distribution uses the SysV style, you should have many
>> directory in /etc/rc.d, one for every 'initlevel' of the system.
>> level 0 is shutdown and level 6 is reboot. Just link your script
>> in there and it will be called during reboot/shutdown. The same
>> happen for level 3.

>> > How do I adapt this line for inclusion into the /etc/rc.d/rc.local file?

>> Leave it like it is, but be sure to specify the complete path of
>> every command.

> Thanks Davide.

> I'm using, Linux version: RedHat 7.2, Kernel 2.4.7-10.

> I do have the multiple levels of /etc/rc.d/rc0.d to rc6.d. In every one
> of those directories there is a file called 'K15postgresql' that is a
> symbolic link to the script '/etc/rc.d/init.d/postgresql'. This file
> seems to be some kind of comphrehensive postgresql script --but I am not
> very familiar with the scripting language.

> Why is this script linked from ALL the rc0.d ... rc6.d directories?

> Despite the existence of the script the postgresql server does not start
> on bootup even though the directories and paths, etc, in the script all
> look correct. Why might this be?

> Any help anyone can give me would be appreciated.

Did you take a look at the my post from yesterday in
col.setup???
As root do:

chkconfig --level 2345 postgresql on
service postgresql start

--
Registered Linux User # 125653 (http://counter.li.org)
Certified: 40% bastard, 22% of which is tard.
http://www.thespark.com/bastardtest

 
 
 

Starting database server at bootup using rc.local question.

Post by Brian Gibso » Mon, 06 May 2002 03:37:47


Yeah doing chkconfig --level 2345 postgresql on
service postgresql start

this will make your server start up as a system service.

This is how HTTPD and SSHD are loaded, this should resolve your issue.



> >> > I need to start a PostgreSQL database server at Linux bootup, so I
need
> >> > to add a line to the file '/etc/rc.d/rc.local'.

> >> I would make a script that accept start/stop, then I would call the
> >> script with the correct parameter from rc.local or from one of the
> >> many script that are run during system startup/shutdown.

> >> If your distribution uses the SysV style, you should have many
> >> directory in /etc/rc.d, one for every 'initlevel' of the system.
> >> level 0 is shutdown and level 6 is reboot. Just link your script
> >> in there and it will be called during reboot/shutdown. The same
> >> happen for level 3.

> >> > How do I adapt this line for inclusion into the /etc/rc.d/rc.local
file?

> >> Leave it like it is, but be sure to specify the complete path of
> >> every command.

> > Thanks Davide.

> > I'm using, Linux version: RedHat 7.2, Kernel 2.4.7-10.

> > I do have the multiple levels of /etc/rc.d/rc0.d to rc6.d. In every one
> > of those directories there is a file called 'K15postgresql' that is a
> > symbolic link to the script '/etc/rc.d/init.d/postgresql'. This file
> > seems to be some kind of comphrehensive postgresql script --but I am not
> > very familiar with the scripting language.

> > Why is this script linked from ALL the rc0.d ... rc6.d directories?

> > Despite the existence of the script the postgresql server does not start
> > on bootup even though the directories and paths, etc, in the script all
> > look correct. Why might this be?

> > Any help anyone can give me would be appreciated.
> Did you take a look at the my post from yesterday in
> col.setup???
> As root do:

> chkconfig --level 2345 postgresql on
> service postgresql start

> --
> Registered Linux User # 125653 (http://counter.li.org)
> Certified: 40% bastard, 22% of which is tard.
> http://www.thespark.com/bastardtest

 
 
 

Starting database server at bootup using rc.local question.

Post by MattSta » Wed, 08 May 2002 02:52:40


Thanks Brian and ne...

Rgds,

..matthew

 
 
 

1. starting apps from /etc/rc.d/rc.local

Can someone help?  I'm trying to run a java server application from the
rc.local file on Caldera 2.2.  From the log files the app writes, I can
tell that it ran, but soon after booting up, the process is dead.  I
tried running the rc.local script from the command line, and that seems
to work fine (the server app. stays alive).

Another thing I've tried is using the Sys V init system in the init.d
directory.  (creating a script from the skeleton file, and creating a
link to it from rc5.d)  This doesn't seem to help.

Am I missing something?  or is rc.local not working to spec on Caldera?

-Trung

p.s.  the reason I'm trying to use rc.local as opposed to .bashrc, etc.
is because I need this to run prior to logging in.

2. minimum HDD size

3. starting Apache from boot on AIX using RC.LOCAL

4. Q: Is there a word-processor type editor?

5. which user does /etc/rc.d/rc.local / rc.sysinit run as?

6. xdm to Solaris 2.5.1 from Linux

7. Strange bootup /etc/rc.{local,net} problem!

8. linking static archive to another static archive

9. Weird problem : rc.inet1 does not start network on bootup

10. How to start a database at bootup.

11. Getting services to start via rc.local

12. starting iptables, rc.local?

13. daemon not starting in rc.local