diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-06-09 01:20:47 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-06-09 01:20:47 +0530 |
| commit | 942f1205174b784e8dee1d80b99fdd951c6b833e (patch) | |
| tree | 3d126c4a46590e8705bff6c94e2ee4ec76188703 /linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst | |
| parent | 9c9d4a713c0f48a9f99e5c3ee9c03d245de4b931 (diff) | |
Deb package - Made service to automatically start during install
Diffstat (limited to 'linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst')
| -rwxr-xr-x | linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst index 430ba0a..67fffe0 100755 --- a/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst +++ b/linux/deb/02-fs-spring-boot-kamal/package/DEBIAN/postinst @@ -28,21 +28,32 @@ chmod 750 /etc/fs-spring-boot-kamal chmod 640 /etc/fs-spring-boot-kamal/application.yaml chmod 640 /etc/fs-spring-boot-kamal/environment.env -# Reload systemd service configurations -systemctl daemon-reload - -# Enable service as boot time -#systemctl enable fs-spring-boot-kamal - -# Restart service -#systemctl restart fs-spring-boot-kamal - -echo "[INFO] fs-spring-boot-kamal service installed." -echo "[INFO] Update /etc/fs-spring-boot-kamal/application.yaml to update the configuration." -echo "[INFO] By default, TCP port 8085 is used by the installed server." -echo "[INFO] To enable service start at boot time:" -echo "[INFO] systemctl enable fs-spring-boot-kamal" -echo "[INFO] To start the service if not running:" -echo "[INFO] systemctl start fs-spring-boot-kamal" -echo "[INFO] To allow access from remote systems, you may have to enable firewall for example by running:" -echo "[INFO] ufw allow 8085/tcp" +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -d /run/systemd/system ]; then + # Reload systemd service configurations + systemctl daemon-reload > /dev/null || true + + if [ -n "$2" ]; then + # Upgrade + # Restart service + if systemctl is-enabled fs-spring-boot-kamal > /dev/null; then + systemctl start fs-spring-boot-kamal + fi + else + # First install (not upgrade) + # Enable service to start at boot time + systemctl enable fs-spring-boot-kamal + # Start service + systemctl start fs-spring-boot-kamal + fi + fi +fi + +if [ "$1" == "configure" ] && [ -z "$2" ]; then + # Code here executes only during package install (but not during upgrade) + echo "[INFO] fs-spring-boot-kamal service installed." + echo "[INFO] Update /etc/fs-spring-boot-kamal/application.yaml to update the configuration." + echo "[INFO] By default, TCP port 8085 is used by the installed server." + echo "[INFO] To allow access from remote systems, you may have to enable firewall for example by running:" + echo "[INFO] ufw allow 8085/tcp" +fi |
