Skip to content

Instantly share code, notes, and snippets.

@ar
Created August 24, 2022 02:22
Show Gist options
  • Save ar/02632d1033df2026569e03503a67ded2 to your computer and use it in GitHub Desktop.
Save ar/02632d1033df2026569e03503a67ded2 to your computer and use it in GitHub Desktop.
jPOS Systemd install script
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This install script must be run as root" 1>&2
exit 1
fi
id -u jpos &>/dev/null || useradd --no-create-home -s /bin/false jpos
umask 027 && mkdir -p /opt/jpos
chown -R jpos.jpos /opt/jpos
chmod 2750 /opt/jpos
cat > /etc/systemd/system/jpos.service <<!
[Unit]
Description=jPOS System
[Service]
User=jpos
ExecStart=/opt/jpos/bin/q2
RestartSec=10
Restart=always
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
!
/usr/bin/systemctl enable jpos
# /usr/bin/systemctl start jpos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment