File: 05pg_ctl

package info (click to toggle)
postgresql 7.4.7-6sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,168 kB
  • ctags: 27
  • sloc: sh: 1,903; makefile: 337; ansic: 204; perl: 69; sed: 6; tcl: 1
file content (81 lines) | stat: -rw-r--r-- 2,564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff -ruN postgresql-7.4.7-old/src/bin/pg_ctl/pg_ctl.sh postgresql-7.4.7/src/bin/pg_ctl/pg_ctl.sh
--- postgresql-7.4.7-old/src/bin/pg_ctl/pg_ctl.sh	2003-08-14 19:56:41.000000000 +0100
+++ postgresql-7.4.7/src/bin/pg_ctl/pg_ctl.sh	2003-08-29 17:04:26.000000000 +0100
@@ -131,31 +131,72 @@
 	    exit 0
 	    ;;
 	-D)
-	    shift
+	    PGDATA="$2"
+            if [ -z "$PGDATA" -o `echo x$PGDATA | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-D' specified without a data directory"
+                exit 1
+            fi
 	    # we need to do this so -D datadir shows in ps display
-	    PGDATAOPTS="-D $1"
-	    PGDATA="$1"
+	    PGDATAOPTS="-D $PGDATA"
 	    export PGDATA
+	    shift
 	    ;;
 	-l)
 	    logfile="$2"
+            if [ -z "$logfile" -o `echo x$logfile | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-l' specified without a logfile"
+                exit 1
+            fi
 	    shift;;
 	-l*)
 	    logfile=`echo "$1" | sed 's/^-l//'`
+            if [ -z "$logfile" -o `echo x$logfile | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-l' specified without a logfile"
+                exit 1
+            fi
 	    ;;
 	-m)
 	    shutdown_mode="$2"
+            if [ -z "$shutdown_mode" -o `echo x$shutdown_mode | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-m' specified without a shutdown mode"
+                exit 1
+            fi
 	    shift;;
 	-m*)
 	    shutdown_mode=`echo "$1" | sed 's/^-m//'`
+            if [ -z "$shutdown_mode" -o `echo x$shutdown_mode | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-m' specified without a shutdown mode"
+                exit 1
+            fi
 	    ;;
 	-o)
+	    POSTOPTS="$2"
+            if [ -z "$POSTOPTS" ]
+            then
+                echo "$CMDNAME: option '-o' specified without any passed options"
+                exit 1
+            fi
+            if [ `echo x$POSTOPTS | cut -c1-2` != x- ]
+            then
+                echo "$CMDNAME: option -o must be followed by one or more further options
+ to pass to the postmaster"
+                exit 1
+            fi
 	    shift
-	    POSTOPTS="$1"
 	    ;;
 	-p)
+	    po_path="$2"
+            if [ -z "$po_path" -o `echo x$po_path | cut -c1-2` = "x-" ]
+            then
+                echo "$CMDNAME: option '-p' specified without a path"
+                exit 1
+            fi
 	    shift
-	    po_path="$1"
 	    ;;
 	-s)
 	    silence_echo=: