summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rc.postgresql/postgresql-log/consumer-for1
-rw-r--r--rc.postgresql/postgresql-log/dependencies4
-rw-r--r--rc.postgresql/postgresql-log/env/CMD1
-rw-r--r--rc.postgresql/postgresql-log/env/CMD_OPTS1
-rw-r--r--rc.postgresql/postgresql-log/env/LOGDIR_GROUP2
-rw-r--r--rc.postgresql/postgresql-log/env/LOGDIR_OWNER2
-rw-r--r--rc.postgresql/postgresql-log/env/LOGDIR_PATH2
-rw-r--r--rc.postgresql/postgresql-log/env/LOGDIR_PERMS2
-rw-r--r--rc.postgresql/postgresql-log/env/LOG_SCRIPT2
-rw-r--r--rc.postgresql/postgresql-log/notification-fd1
-rw-r--r--rc.postgresql/postgresql-log/pipeline-name1
-rw-r--r--rc.postgresql/postgresql-log/run24
-rw-r--r--rc.postgresql/postgresql-log/type1
-rwxr-xr-xrc.postgresql/postgresql-srv/data/check7
-rw-r--r--rc.postgresql/postgresql-srv/dependencies6
-rw-r--r--rc.postgresql/postgresql-srv/down-signal1
-rw-r--r--rc.postgresql/postgresql-srv/env/CMD1
-rw-r--r--rc.postgresql/postgresql-srv/env/CMD_OPTS1
-rw-r--r--rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_FILE1
-rw-r--r--rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_VALUE1
-rw-r--r--rc.postgresql/postgresql-srv/env/PG_VERSION1
-rw-r--r--rc.postgresql/postgresql-srv/notification-fd1
-rw-r--r--rc.postgresql/postgresql-srv/producer-for1
-rw-r--r--rc.postgresql/postgresql-srv/run23
-rw-r--r--rc.postgresql/postgresql-srv/type1
25 files changed, 89 insertions, 0 deletions
diff --git a/rc.postgresql/postgresql-log/consumer-for b/rc.postgresql/postgresql-log/consumer-for
new file mode 100644
index 0000000..7ab98b6
--- /dev/null
+++ b/rc.postgresql/postgresql-log/consumer-for
@@ -0,0 +1 @@
+postgresql-srv
diff --git a/rc.postgresql/postgresql-log/dependencies b/rc.postgresql/postgresql-log/dependencies
new file mode 100644
index 0000000..e85efae
--- /dev/null
+++ b/rc.postgresql/postgresql-log/dependencies
@@ -0,0 +1,4 @@
+# Comment out "remount-root" and uncomment "local-fs"
+# if you use separate partition for /var/log
+remount-root
+#local-fs
diff --git a/rc.postgresql/postgresql-log/env/CMD b/rc.postgresql/postgresql-log/env/CMD
new file mode 100644
index 0000000..9d5239c
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/CMD
@@ -0,0 +1 @@
+s6-log
diff --git a/rc.postgresql/postgresql-log/env/CMD_OPTS b/rc.postgresql/postgresql-log/env/CMD_OPTS
new file mode 100644
index 0000000..00d672e
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/CMD_OPTS
@@ -0,0 +1 @@
+-d3
diff --git a/rc.postgresql/postgresql-log/env/LOGDIR_GROUP b/rc.postgresql/postgresql-log/env/LOGDIR_GROUP
new file mode 100644
index 0000000..3794bcd
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/LOGDIR_GROUP
@@ -0,0 +1,2 @@
+root
+# Logging directory group ownership
diff --git a/rc.postgresql/postgresql-log/env/LOGDIR_OWNER b/rc.postgresql/postgresql-log/env/LOGDIR_OWNER
new file mode 100644
index 0000000..9f9fd12
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/LOGDIR_OWNER
@@ -0,0 +1,2 @@
+root
+# Logging directory owner
diff --git a/rc.postgresql/postgresql-log/env/LOGDIR_PATH b/rc.postgresql/postgresql-log/env/LOGDIR_PATH
new file mode 100644
index 0000000..bac038b
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/LOGDIR_PATH
@@ -0,0 +1,2 @@
+/var/log/postgresql
+# Logging directory path
diff --git a/rc.postgresql/postgresql-log/env/LOGDIR_PERMS b/rc.postgresql/postgresql-log/env/LOGDIR_PERMS
new file mode 100644
index 0000000..ccece6e
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/LOGDIR_PERMS
@@ -0,0 +1,2 @@
+750
+# Logging directory access rights in octal
diff --git a/rc.postgresql/postgresql-log/env/LOG_SCRIPT b/rc.postgresql/postgresql-log/env/LOG_SCRIPT
new file mode 100644
index 0000000..017b42c
--- /dev/null
+++ b/rc.postgresql/postgresql-log/env/LOG_SCRIPT
@@ -0,0 +1,2 @@
+n4 s500000 $LOGDIR_PATH
+# Logging script used by s6-log
diff --git a/rc.postgresql/postgresql-log/notification-fd b/rc.postgresql/postgresql-log/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/rc.postgresql/postgresql-log/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/rc.postgresql/postgresql-log/pipeline-name b/rc.postgresql/postgresql-log/pipeline-name
new file mode 100644
index 0000000..a02a1cc
--- /dev/null
+++ b/rc.postgresql/postgresql-log/pipeline-name
@@ -0,0 +1 @@
+postgresql
diff --git a/rc.postgresql/postgresql-log/run b/rc.postgresql/postgresql-log/run
new file mode 100644
index 0000000..7628e26
--- /dev/null
+++ b/rc.postgresql/postgresql-log/run
@@ -0,0 +1,24 @@
+#!/bin/execlineb -P
+
+####################################################
+# Start a logging daemon for the postgresql daemon #
+####################################################
+
+s6-envdir env
+multisubstitute {
+ importas -u LOGDIR_OWNER LOGDIR_OWNER
+ importas -u LOGDIR_GROUP LOGDIR_GROUP
+ importas -u LOGDIR_PERMS LOGDIR_PERMS
+ importas -u CMD CMD
+ importas -usCd" " CMD_OPTS CMD_OPTS
+ importas -usCd" " LOG_SCRIPT LOG_SCRIPT
+}
+s6-envuidgid -B ${LOGDIR_OWNER}:${LOGDIR_GROUP}
+multisubstitute {
+ importas -u LOGDIR_PATH LOGDIR_PATH
+ importas -u UID UID
+ importas -u GID GID
+}
+if { install -dm $LOGDIR_PERMS -o $UID -g $GID $LOGDIR_PATH }
+s6-setuidgid ${UID}:${GID}
+exec -c $CMD $CMD_OPTS -- $LOG_SCRIPT
diff --git a/rc.postgresql/postgresql-log/type b/rc.postgresql/postgresql-log/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/rc.postgresql/postgresql-log/type
@@ -0,0 +1 @@
+longrun
diff --git a/rc.postgresql/postgresql-srv/data/check b/rc.postgresql/postgresql-srv/data/check
new file mode 100755
index 0000000..bc8bb10
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/data/check
@@ -0,0 +1,7 @@
+#!/bin/execlineb -P
+
+s6-envdir env
+importas -u PG_VERSION PG_VERSION
+pipeline { tail -n1 /var/lib/pgsql/${PG_VERSION}/data/postmaster.pid }
+pipeline { tr -d " \n" }
+xargs test ready =
diff --git a/rc.postgresql/postgresql-srv/dependencies b/rc.postgresql/postgresql-srv/dependencies
new file mode 100644
index 0000000..bf84970
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/dependencies
@@ -0,0 +1,6 @@
+procfs
+network
+# Comment out "remount-root" and uncomment "local-fs"
+# if you use separate partition for /var
+#remount-root
+local-fs
diff --git a/rc.postgresql/postgresql-srv/down-signal b/rc.postgresql/postgresql-srv/down-signal
new file mode 100644
index 0000000..d751378
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/down-signal
@@ -0,0 +1 @@
+SIGINT
diff --git a/rc.postgresql/postgresql-srv/env/CMD b/rc.postgresql/postgresql-srv/env/CMD
new file mode 100644
index 0000000..ebd1610
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/env/CMD
@@ -0,0 +1 @@
+/usr/lib64/postgresql/${PG_VERSION}/bin/postgres
diff --git a/rc.postgresql/postgresql-srv/env/CMD_OPTS b/rc.postgresql/postgresql-srv/env/CMD_OPTS
new file mode 100644
index 0000000..ebe0e69
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/env/CMD_OPTS
@@ -0,0 +1 @@
+-D /var/lib/pgsql/${PG_VERSION}/data
diff --git a/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_FILE b/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_FILE
new file mode 100644
index 0000000..ab41318
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_FILE
@@ -0,0 +1 @@
+/proc/self/oom_score_adj
diff --git a/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_VALUE b/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_VALUE
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/env/PG_OOM_ADJUST_VALUE
@@ -0,0 +1 @@
+0
diff --git a/rc.postgresql/postgresql-srv/env/PG_VERSION b/rc.postgresql/postgresql-srv/env/PG_VERSION
new file mode 100644
index 0000000..8351c19
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/env/PG_VERSION
@@ -0,0 +1 @@
+14
diff --git a/rc.postgresql/postgresql-srv/notification-fd b/rc.postgresql/postgresql-srv/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/rc.postgresql/postgresql-srv/producer-for b/rc.postgresql/postgresql-srv/producer-for
new file mode 100644
index 0000000..ffe5b68
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/producer-for
@@ -0,0 +1 @@
+postgresql-log
diff --git a/rc.postgresql/postgresql-srv/run b/rc.postgresql/postgresql-srv/run
new file mode 100644
index 0000000..2aa341d
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/run
@@ -0,0 +1,23 @@
+#!/bin/execlineb -P
+
+###################################################################
+# Start PostgreSQL (object-relational database management system) #
+###################################################################
+
+fdmove -c 2 1
+getpid PID
+s6-envdir env
+multisubstitute {
+ importas -u PID PID
+ importas -u CMD CMD
+ importas -usCd" " CMD_OPTS CMD_OPTS
+}
+importas -u PG_VERSION PG_VERSION
+foreground {
+ if { test -e /proc/${PID}/oom_score_adj }
+ redirfd -w 1 /proc/${PID}/oom_score_adj
+ echo -1000
+}
+s6-notifyoncheck
+s6-setuidgid postgres
+exec -c $CMD $CMD_OPTS
diff --git a/rc.postgresql/postgresql-srv/type b/rc.postgresql/postgresql-srv/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/rc.postgresql/postgresql-srv/type
@@ -0,0 +1 @@
+longrun