vi /etc/init.d/postgresql7 -------------------------------------- #!/bin/sh # # PostgreSQL7 start and shutdown script # # chkconfig: 345 90 11 # description: PostgreSQL start and shutdown script . /etc/init.d/functions case "$1" in start) su - postgres7 -c "/opt/postgresql7/bin/pg_ctl -o \"-S -i\" -D /opt/postgresql7/data start" touch /var/lock/subsys/postgres ;; stop) su - postgres7 -c "/opt/postgresql7/bin/pg_ctl -m f -D /opt/postgresql7/data stop" rm -f /var/lock/subsys/postgres ;; *) echo "Usage: /etc/rc.d/init.d/postgres {start|stop}" esac exit 0 -------------------------------------- chmod +x /etc/init.d/postgresql7