changeset 1635:fd3d56f39450

rearrange startup files
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Dec 2021 18:50:43 -0700
parents 894d9069c792
children 8efb10bf569a
files host/addStartupScripts.sh host/addStartupScriptsPostgres.sh host/doc/autostart.txt host/doc/backup.txt host/macos/addStartupScripts.sh host/macos/addStartupScriptsPostgres.sh host/macos/limit.maxfiles.plist host/macos/limit.maxproc.plist host/macos/postgres/luanhost.postgresql.plist host/macos/removeStartupScripts.sh host/macos/renewSsl.plist host/macos/startLuanhost.plist host/macos/startLuanhost.sh host/macos/startupScripts.sh host/removeStartupScripts.sh host/startup/macos/limit.maxfiles.plist host/startup/macos/limit.maxproc.plist host/startup/macos/renewSsl.plist host/startup/macos/startLuanhost.plist host/startup/macos/startLuanhost.sh host/startup/postgres/macos/luanhost.postgresql.plist host/startup/renewSsl.sh host/startupScripts.sh
diffstat 23 files changed, 206 insertions(+), 213 deletions(-) [+]
line wrap: on
line diff
diff -r 894d9069c792 -r fd3d56f39450 host/addStartupScripts.sh
--- a/host/addStartupScripts.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-. startupScripts.sh;
-
-mkdir -p $localStartup 2>/dev/null;
-
-cd $startup;
-for file in *.plist; do
-    log=${ROOTPWD}"/logs/startup.${file}.log";
-	sed "s~PWD~${startup}~g;\
-	     s~LOG~${log}~g;\
-	     s~USER~${user}~g;\
-	     s~ROOT~${ROOTPWD}~g" $file > ${localStartup}/${file};
-done;
-
-addStartup;
-
-cd $ROOTPWD;
diff -r 894d9069c792 -r fd3d56f39450 host/addStartupScriptsPostgres.sh
--- a/host/addStartupScriptsPostgres.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-SLAVE_IP=$1;
-. startupScripts.sh;
-mkdir -p $localStartup"/postgres" 2>/dev/null;
-
-cd $startupPostgres;
-for file in *.plist; do
-    log=${ROOTPWD}"/logs/startup.${file}.log";
-	sed "s~PWD~${startup}~g;\
-	     s~LOG~${log}~g;\
-	     s~USER~${user}~g;\
-	     s~ROOT~${ROOTPWD}~g" $file > ${localStartup}/${file};
-done;
-
-cd ../;
-
-cp postgresql.conf ${localStartup}/postgres/postgresql.conf;
-mv /usr/local/var/postgresql@9.5/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf.bak;
-ln -sf ${localStartup}/postgres/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf;
-
-sed "s/SLAVE_IP/${SLAVE_IP}/g" pg_hba.conf > ${localStartup}/postgres/pg_hba.conf;
-mv /usr/local/var/postgresql@9.5/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf.bak;
-ln -sf ${localStartup}/postgres/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf;
-
-addStartup;
-
-cd $ROOTPWD;
diff -r 894d9069c792 -r fd3d56f39450 host/doc/autostart.txt
--- a/host/doc/autostart.txt	Tue Dec 14 17:37:09 2021 -0700
+++ b/host/doc/autostart.txt	Tue Dec 14 18:50:43 2021 -0700
@@ -8,7 +8,9 @@
   sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.pfctl.plist
 
 3) Add plists (need sudo password)
+  cd macos
   ./addStartupScripts.sh
 
 If you need to remove plists use
+  cd macos
   ./removeStartupScripts.sh
diff -r 894d9069c792 -r fd3d56f39450 host/doc/backup.txt
--- a/host/doc/backup.txt	Tue Dec 14 17:37:09 2021 -0700
+++ b/host/doc/backup.txt	Tue Dec 14 18:50:43 2021 -0700
@@ -6,6 +6,7 @@
 brew tap caskroom/versions
 brew install postgresql@9.5
 
+cd macos
 ./addStartupScriptsPostgres.sh slave_ip
 
 create replica
diff -r 894d9069c792 -r fd3d56f39450 host/macos/addStartupScripts.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/addStartupScripts.sh	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. startupScripts.sh;
+
+mkdir -p $localStartup 2>/dev/null;
+
+cd $startup;
+for file in *.plist; do
+    log=${ROOTPWD}"/logs/startup.${file}.log";
+	sed "s~PWD~${startup}~g;\
+	     s~LOG~${log}~g;\
+	     s~USER~${user}~g;\
+	     s~ROOT~${ROOTPWD}~g" $file > ${localStartup}/${file};
+done;
+
+addStartup;
+
+cd $ROOTPWD;
diff -r 894d9069c792 -r fd3d56f39450 host/macos/addStartupScriptsPostgres.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/addStartupScriptsPostgres.sh	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+SLAVE_IP=$1;
+. startupScripts.sh;
+mkdir -p $localStartup"/postgres" 2>/dev/null;
+
+cd $startupPostgres;
+for file in *.plist; do
+    log=${ROOTPWD}"/logs/startup.${file}.log";
+	sed "s~PWD~${startup}~g;\
+	     s~LOG~${log}~g;\
+	     s~USER~${user}~g;\
+	     s~ROOT~${ROOTPWD}~g" $file > ${localStartup}/${file};
+done;
+
+cd $ROOTPWD/startup/postgres;
+
+cp postgresql.conf ${localStartup}/postgres/postgresql.conf;
+mv /usr/local/var/postgresql@9.5/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf.bak;
+ln -sf ${localStartup}/postgres/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf;
+
+sed "s/SLAVE_IP/${SLAVE_IP}/g" pg_hba.conf > ${localStartup}/postgres/pg_hba.conf;
+mv /usr/local/var/postgresql@9.5/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf.bak;
+ln -sf ${localStartup}/postgres/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf;
+
+addStartup;
+
+cd $ROOTPWD;
diff -r 894d9069c792 -r fd3d56f39450 host/macos/limit.maxfiles.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/limit.maxfiles.plist	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>Label</key>
+        <string>limit.maxfiles</string>
+        <key>ProgramArguments</key>
+        <array>
+            <string>launchctl</string>
+            <string>limit</string>
+            <string>maxfiles</string>
+            <string>65536</string>
+            <string>65536</string>
+        </array>
+        <key>RunAtLoad</key>
+        <true/>
+        <key>ServiceIPC</key>
+        <false/>
+    </dict>
+</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/macos/limit.maxproc.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/limit.maxproc.plist	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>Label</key>
+        <string>limit.maxproc</string>
+        <key>ProgramArguments</key>
+        <array>
+            <string>launchctl</string>
+            <string>limit</string>
+            <string>maxproc</string>
+            <string>2048</string>
+            <string>2048</string>
+        </array>
+        <key>RunAtLoad</key>
+        <true />
+        <key>ServiceIPC</key>
+        <false />
+    </dict>
+</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/macos/postgres/luanhost.postgresql.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/postgres/luanhost.postgresql.plist	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>KeepAlive</key>
+        <true/>
+        <key>Label</key>
+        <string>luanhost.postgresql</string>
+        <key>ProgramArguments</key>
+        <array>
+            <string>/usr/local/opt/postgresql@9.5/bin/postgres</string>
+            <string>-D</string>
+            <string>/usr/local/var/postgresql@9.5</string>
+        </array>
+        <key>RunAtLoad</key>
+        <true/>
+        <key>WorkingDirectory</key>
+        <string>/usr/local</string>
+        <key>UserName</key>
+        <string>USER</string>
+        <key>StandardErrorPath</key>
+        <string>LOG</string>
+        <key>StandardOutPath</key>
+        <string>LOG</string>
+    </dict>
+</plist>
\ No newline at end of file
diff -r 894d9069c792 -r fd3d56f39450 host/macos/removeStartupScripts.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/removeStartupScripts.sh	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+. startupScripts.sh;
+
+cd $localStartup;
+
+for file in *.plist; do
+	sudo rm ${systemStarup}/${file};
+	sudo rm $file;
+done;
diff -r 894d9069c792 -r fd3d56f39450 host/macos/renewSsl.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/renewSsl.plist	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>Label</key>
+            <string>com.luanhost.renewSsl</string>
+        <key>ProgramArguments</key>
+        <array>
+            <string>ROOT/renewSsl.sh</string>
+            <string>ROOT</string>
+        </array>
+        <key>StartCalendarInterval</key>
+        <array>
+            <dict>
+                <key>Hour</key>
+                <integer>00</integer>
+                <key>Minute</key>
+                <integer>00</integer>
+            </dict>
+        </array>
+        <key>AbandonProcessGroup</key>
+            <true/>
+        <key>UserName</key>
+            <string>USER</string>
+        <key>StandardErrorPath</key>
+            <string>LOG</string>
+        <key>StandardOutPath</key>
+            <string>LOG</string>
+        <key>RunAtLoad</key><false/>
+        <key>KeepAlive</key><false/>
+    </dict>
+</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/macos/startLuanhost.plist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/startLuanhost.plist	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>Label</key>
+        <string>com.luanhost.startLuanhost</string>
+        <key>ProgramArguments</key>
+        <array>
+            <string>PWD/startLuanhost.sh</string>
+            <string>ROOT</string>
+        </array>
+        <key>UserName</key>
+        <string>USER</string>
+        <key>RunAtLoad</key>
+        <true/>
+        <key>StandardErrorPath</key>
+        <string>LOG</string>
+        <key>StandardOutPath</key>
+        <string>LOG</string>
+    </dict>
+</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/macos/startLuanhost.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/startLuanhost.sh	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -eu
+
+cd "$1";
+
+#can't determine if network is available at startup
+sleep 60;
+
+./start.sh "launchd";
diff -r 894d9069c792 -r fd3d56f39450 host/macos/startupScripts.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/macos/startupScripts.sh	Tue Dec 14 18:50:43 2021 -0700
@@ -0,0 +1,18 @@
+cd ..
+ROOTPWD=$(pwd);
+IP=$(ifconfig en0 | awk '{if($0~"inet "){print $2}}');
+
+user=$(whoami);
+
+systemStarup='/Library/LaunchDaemons';
+localStartup=${ROOTPWD}'/local/startup';
+startup=${ROOTPWD}'/macos';
+startupPostgres=${ROOTPWD}'/macos/postgres';
+
+function addStartup() {
+  cd $localStartup;
+  for file in *.plist; do
+    sudo ln -sf ${localStartup}/${file} ${systemStarup}/${file};
+    sudo chown root:wheel ${localStartup}/${file};
+  done;
+}
diff -r 894d9069c792 -r fd3d56f39450 host/removeStartupScripts.sh
--- a/host/removeStartupScripts.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-. startupScripts.sh;
-
-cd $localStartup;
-
-for file in *.plist; do
-	sudo rm ${systemStarup}/${file};
-	sudo rm $file;
-done;
diff -r 894d9069c792 -r fd3d56f39450 host/startup/macos/limit.maxfiles.plist
--- a/host/startup/macos/limit.maxfiles.plist	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>Label</key>
-        <string>limit.maxfiles</string>
-        <key>ProgramArguments</key>
-        <array>
-            <string>launchctl</string>
-            <string>limit</string>
-            <string>maxfiles</string>
-            <string>65536</string>
-            <string>65536</string>
-        </array>
-        <key>RunAtLoad</key>
-        <true/>
-        <key>ServiceIPC</key>
-        <false/>
-    </dict>
-</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/startup/macos/limit.maxproc.plist
--- a/host/startup/macos/limit.maxproc.plist	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>Label</key>
-        <string>limit.maxproc</string>
-        <key>ProgramArguments</key>
-        <array>
-            <string>launchctl</string>
-            <string>limit</string>
-            <string>maxproc</string>
-            <string>2048</string>
-            <string>2048</string>
-        </array>
-        <key>RunAtLoad</key>
-        <true />
-        <key>ServiceIPC</key>
-        <false />
-    </dict>
-</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/startup/macos/renewSsl.plist
--- a/host/startup/macos/renewSsl.plist	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>Label</key>
-            <string>com.luanhost.renewSsl</string>
-        <key>ProgramArguments</key>
-        <array>
-            <string>ROOT/renewSsl.sh</string>
-            <string>ROOT</string>
-        </array>
-        <key>StartCalendarInterval</key>
-        <array>
-            <dict>
-                <key>Hour</key>
-                <integer>00</integer>
-                <key>Minute</key>
-                <integer>00</integer>
-            </dict>
-        </array>
-        <key>AbandonProcessGroup</key>
-            <true/>
-        <key>UserName</key>
-            <string>USER</string>
-        <key>StandardErrorPath</key>
-            <string>LOG</string>
-        <key>StandardOutPath</key>
-            <string>LOG</string>
-        <key>RunAtLoad</key><false/>
-        <key>KeepAlive</key><false/>
-    </dict>
-</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/startup/macos/startLuanhost.plist
--- a/host/startup/macos/startLuanhost.plist	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>Label</key>
-        <string>com.luanhost.startLuanhost</string>
-        <key>ProgramArguments</key>
-        <array>
-            <string>PWD/startLuanhost.sh</string>
-            <string>ROOT</string>
-        </array>
-        <key>UserName</key>
-        <string>USER</string>
-        <key>RunAtLoad</key>
-        <true/>
-        <key>StandardErrorPath</key>
-        <string>LOG</string>
-        <key>StandardOutPath</key>
-        <string>LOG</string>
-    </dict>
-</plist>
diff -r 894d9069c792 -r fd3d56f39450 host/startup/macos/startLuanhost.sh
--- a/host/startup/macos/startLuanhost.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-set -eu
-
-cd "$1";
-
-#can't determine if network is available at startup
-sleep 60;
-
-./start.sh "launchd";
diff -r 894d9069c792 -r fd3d56f39450 host/startup/postgres/macos/luanhost.postgresql.plist
--- a/host/startup/postgres/macos/luanhost.postgresql.plist	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>KeepAlive</key>
-        <true/>
-        <key>Label</key>
-        <string>luanhost.postgresql</string>
-        <key>ProgramArguments</key>
-        <array>
-            <string>/usr/local/opt/postgresql@9.5/bin/postgres</string>
-            <string>-D</string>
-            <string>/usr/local/var/postgresql@9.5</string>
-        </array>
-        <key>RunAtLoad</key>
-        <true/>
-        <key>WorkingDirectory</key>
-        <string>/usr/local</string>
-        <key>UserName</key>
-        <string>USER</string>
-        <key>StandardErrorPath</key>
-        <string>LOG</string>
-        <key>StandardOutPath</key>
-        <string>LOG</string>
-    </dict>
-</plist>
\ No newline at end of file
diff -r 894d9069c792 -r fd3d56f39450 host/startup/renewSsl.sh
--- a/host/startup/renewSsl.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cd "$1";
-
-ROOTPWD=$(pwd);
-
-./acme.sh --renew-all --cert-home "$ROOTPWD"/sites --config-home "$ROOTPWD"/local/letsencrypt/config;
-
-sudo $(which nginx) -s reload;
diff -r 894d9069c792 -r fd3d56f39450 host/startupScripts.sh
--- a/host/startupScripts.sh	Tue Dec 14 17:37:09 2021 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-ROOTPWD=$(pwd);
-IP=$(ifconfig en0 | awk '{if($0~"inet "){print $2}}');
-
-user=$(whoami);
-
-systemStarup='/Library/LaunchDaemons';
-localStartup=${ROOTPWD}'/local/startup';
-startup=${ROOTPWD}'/startup/macos';
-startupPostgres=${ROOTPWD}'/startup/postgres/macos';
-
-function addStartup() {
-  cd $localStartup;
-  for file in *.plist; do
-    sudo ln -sf ${localStartup}/${file} ${systemStarup}/${file};
-    sudo chown root:wheel ${localStartup}/${file};
-  done;
-}