From 5da9b76577a2dc4bea6c7dbdfe278d7b05b33c78 Mon Sep 17 00:00:00 2001 From: Juhyung Park Date: Thu, 17 Oct 2024 12:59:49 +0900 Subject: [PATCH] Start systemd services automatically Signed-off-by: Juhyung Park --- README.md | 13 ------------- install.sh | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 854a0ee..e3120f5 100644 --- a/README.md +++ b/README.md @@ -145,19 +145,6 @@ In summary, the `install.sh` script does the following: * Limits listening host from 0.0.0.0 to 127.0.0.1. If you do not want this to happen (make sure you fully understand the security risks!), comment out the `sed` command in `install.sh`'s "Use 127.0.0.1" part. -## 6. Install systemd services - -Because the install script switches to the immich user during installation, you must install systemd services manually: - -``` bash -sudo cp immich*.service /etc/systemd/system/ -sudo systemctl daemon-reload -for i in immich*.service; do - sudo systemctl enable $i - sudo systemctl start $i -done -``` - ## Done! Your Immich installation should be running at 3001 port, listening from localhost (127.0.0.1). diff --git a/install.sh b/install.sh index 9a12de0..5a6fa1c 100755 --- a/install.sh +++ b/install.sh @@ -24,8 +24,17 @@ if [[ "$USER" != "immich" ]]; then mkdir -p /var/log/immich chown immich:immich /var/log/immich - echo "Restarting the script as user immich" - exec sudo -u immich $0 $* + echo "Forking the script as user immich" + sudo -u immich $0 $* + + echo "Starting systemd services" + cp immich*.service /etc/systemd/system/ + systemctl daemon-reload + for i in immich*.service; do + systemctl enable $i + systemctl start $i + done + exit 0 fi BASEDIR=$(dirname "$0") @@ -166,5 +175,5 @@ EOF rm -rf $TMP echo -echo "Done. Please install the systemd services to start using Immich." +echo "Done." echo