enable linger in script
This commit is contained in:
parent
9b2c71cf16
commit
8d2d2beddc
2 changed files with 9 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ log() {
|
||||||
echo "$message" | sed 's/\\e\[[0-9;]*m//g' >> "$TMP_LOG_FILE"
|
echo "$message" | sed 's/\\e\[[0-9;]*m//g' >> "$TMP_LOG_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_VERSION="0.3.0"
|
SCRIPT_VERSION="0.3.1"
|
||||||
REPO="shocknet/Lightning.Pub"
|
REPO="shocknet/Lightning.Pub"
|
||||||
BRANCH="master"
|
BRANCH="master"
|
||||||
|
|
||||||
|
|
@ -181,14 +181,14 @@ detect_os_arch
|
||||||
|
|
||||||
# Define installation paths based on user
|
# Define installation paths based on user
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
IS_ROOT=true
|
export IS_ROOT=true
|
||||||
# For root, install under /opt for system-wide access
|
# For root, install under /opt for system-wide access
|
||||||
export INSTALL_DIR="/opt/lightning_pub"
|
export INSTALL_DIR="/opt/lightning_pub"
|
||||||
export UNIT_DIR="/etc/systemd/system"
|
export UNIT_DIR="/etc/systemd/system"
|
||||||
export SYSTEMCTL_CMD="systemctl"
|
export SYSTEMCTL_CMD="systemctl"
|
||||||
log "Running as root: App will be installed in $INSTALL_DIR"
|
log "Running as root: App will be installed in $INSTALL_DIR"
|
||||||
else
|
else
|
||||||
IS_ROOT=false
|
export IS_ROOT=false
|
||||||
export INSTALL_DIR="$HOME/lightning_pub"
|
export INSTALL_DIR="$HOME/lightning_pub"
|
||||||
export UNIT_DIR="$HOME/.config/systemd/user"
|
export UNIT_DIR="$HOME/.config/systemd/user"
|
||||||
export SYSTEMCTL_CMD="systemctl --user"
|
export SYSTEMCTL_CMD="systemctl --user"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,12 @@ start_services() {
|
||||||
|
|
||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
if [ "$SYSTEMCTL_AVAILABLE" = true ]; then
|
if [ "$SYSTEMCTL_AVAILABLE" = true ]; then
|
||||||
|
# Enable linger for user services so they persist after logout
|
||||||
|
if [ "$IS_ROOT" = false ] && command -v loginctl &> /dev/null; then
|
||||||
|
log "Enabling linger for user services to persist after logout..."
|
||||||
|
loginctl enable-linger || log "Warning: Failed to enable linger. Services may stop after logout."
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$UNIT_DIR"
|
mkdir -p "$UNIT_DIR"
|
||||||
|
|
||||||
# Check and create lnd.service if needed (only if it doesn't exist)
|
# Check and create lnd.service if needed (only if it doesn't exist)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue