wok view postgresql/stuff/etc/init.d/postgresql @ rev 1289
postgresql: typo in init script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 20 19:40:43 2008 +0000 (2008-08-20) |
parents | 5b9d8b86855a |
children | df0ba7a1b7e1 |
line source
1 #!/bin/sh
2 # /etc/init.d/postgresql : Start, stop and restart PostgreSQL server on SliTaz,
3 # at boot time or with the command line.
4 #
5 # To start postgresql server at boot time, just put postgresql in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Postgresql
12 DESC="PostgreSQL server"
13 OPTIONS=$PGSQL_OPTIONS
14 [ -n "$OPTIONS" ] || OPTIONS="-D /var/lib/pgsql -s"
16 case "$1" in
17 start)
18 if [ ! -f /var/lib/pgsql/PG_VERSION ]; then
19 echo "Initializing $DESC database"
20 rm -rf /var/lib/pgsql/* 2> /dev/null
21 su -c "initdb -D /var/lib/pgsql" - postgres
22 fi
23 echo -n "Starting $DESC: $NAME... "
24 su -c "pg_ctl start -w $OPTIONS -l /var/log/postgresql/postgresql.log" - postgres
25 status
26 # su -c "createdb test" - postgres
27 # su -c "psql test" - postgres
28 ;;
29 stop)
30 echo -n "Stopping $DESC: $NAME... "
31 su -c "pg_ctl stop $OPTIONS -m smart" - postgres
32 status
33 ;;
34 restart)
35 echo -n "Restarting $DESC: $NAME... "
36 su -c "pg_ctl restart $OPTIONS -m smart" - postgres
37 status
38 ;;
39 reload)
40 echo -n "Reloading $DESC: $NAME... "
41 su -c "pg_ctl reload $OPTIONS" - postgres
42 status
43 ;;
44 *)
45 echo ""
46 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
47 echo ""
48 exit 1
49 ;;
50 esac
52 exit 0