LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
LinkBack Search this Thread
Old 08-10-2006, 03:26 AM   #1
ttphuong82
LQ Newbie
 
Registered: Aug 2006
Posts: 4

Rep: Reputation: 0
How to auto start Postgresql 8.0.7 on Fedora 5


Dear everybody
I installed postgresql 8.0.7 on Fedora 5 successful.Now i want to auto start postgresql. So i copied the auto start script to /etc/init.d and made some changes to correct this script. And i also registered postgresql to the services management (using chkconfig).
The content of auto start script is as follow:

# Installation prefix
prefix=/usr/local/pgsql

# Data directory
PGDATA="/usr/local/pgsql/data"

# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=postgres

# Where to keep a log file
PGLOG="$PGDATA/serverlog"

## STOP EDITING HERE

# Check for echo -n vs echo \c
if echo '\c' | grep -s c >/dev/null 2>&1 ; then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi

# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster"

# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"

set -e

# Only start if we can find the postmaster.
test -x $DAEMON || exit 0

# Parse command line parameters.
case $1 in
start)
$ECHO_N "Starting PostgreSQL: "$ECHO_C
su - $PGUSER -c "$DAEMON -i -D $PGDATA" >>$PGLOG 2>&1 &
echo "ok"
;;
stop)
echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
echo "ok"
;;
restart)
echo -n "Restarting PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
su - $PGUSER -c "$DAEMON -D $PGDATA" >>$PGLOG 2>&1 &
echo "ok"
;;
reload)
echo -n "Reload PostgreSQL: "
su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
echo "ok"
;;
status)
su - $PGUSER -c "$PGCTL status -D '$PGDATA'"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
exit 1
;;
esac

exit 0


I can run this script normally after i login. But when i boot system, the console informs that postgresql starts succcesful. But actually, postgresql doesn't start, and log file doesn't changed any more. So log file doesn't give me any information about the errors. I wonder why there is the different when running this script before and after i login. And why the console informs postgresql start succesful but it doesn't.
Everybody knows the reason, please help me.
 
Old 08-24-2006, 10:02 AM   #2
ttphuong82
LQ Newbie
 
Registered: Aug 2006
Posts: 4

Original Poster
Rep: Reputation: 0
After i install default postgresql 8.1.4 packages attached Fedora 5, the auto start script of postgresql give me some glues. Because Fedora 5 has SELinux policy, so i must use 'runuser' command instead of 'su' command. And i only make this change to above script. The problem is fixed.But with another services, no need to use 'runuser' to replace 'su'.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto start a program in XFree on Fedora? MCSquared Fedora 22 09-12-2007 05:55 PM
How do I auto start modules that aren't auto loaded on boot? darkbluedrew Debian 2 09-18-2005 09:10 AM
eth0 Auto Connect, How to auto start on logon cornish Linux - Networking 2 05-09-2005 12:02 PM
PostgreSQL trying to start? pixie Linux - Software 4 04-28-2004 09:27 AM
how to start PostgreSQL under cygwin? powerplane General 0 07-06-2003 09:56 PM


All times are GMT -5. The time now is 09:19 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration