0 like 0 dislike
170 views

Please log in or register to answer this question.

1 Answer

0 like 0 dislike
answered by (4k points)  

below instructions for postgres auto stop and start. Please test first in testing server. Kindly let us know incase of issues during implementation.
Script provided for postgres auto stop and start, but in below script we mentioned that script will be successfully tested in postgres server.


1) Create scripts (postgres_start.sh,postgres_start.sh) in the path /etc/init.d/

====postgresql_start.sh=====
#!/bin/bash
runuser -l insta -c '$PGHOME/bin/pg_ctl -D $PGDATA start > $PGDATA/start_log.txt.`date -I`'      
====postgresql_stop.sh====
#!/bin/bash
runuser -l insta -c '$PGHOME/bin/pg_ctl -D $PGDATA stop > $PGDATA/stop_log.txt.`date -I`'

2) create a soft link in the runlevel to pick the script as a servcie.

<<Hostname>>:/etc/init.d/rc3.d # ln -s ../postgresql_stop.sh K60postgres_stop ===> for stop/kill
<<Hostname>>:/etc/init.d/rc3.d # ln -s ../postgresql_start.sh S60postgres_stop ===> for start

==>>> Test it by rebooting the server 


 

Related questions

0 like 0 dislike
1 answer
...