[Unit] Description=Cryptshare Server After=network.target [Service] Type=simple # Main Java command to start Cryptshare ExecStart=/bin/bash -c 'if [ -d /opt/cryptshare-3 ]; then exec /opt/cryptshare-3/start-cryptshare.sh; else exec /opt/cryptshare/start-cryptshare.sh; fi' StandardOutput=journal StandardError=journal # To kill only the main process (so that the updater.jar will be leave alone to be completed.) KillMode=process # Restart on failure Restart=always RestartSec=5s # Run as root (modify if running as a non-root user is preferred) User=root Group=root [Install] WantedBy=multi-user.target