krakenrf / krakensdr_docs

Documentation and Wiki for KrakenSDR
110 stars 25 forks source link

[Help] How to Autostart after boot #24

Closed ChandraOrbit closed 1 month ago

ChandraOrbit commented 1 month ago

Hi, I just bought Kraken and successfully installed it on Raspberry Pi5, but I want kraken to run automatically after it finishes booting Can you provide guidance? Thank You

krakenrf commented 1 month ago

If you're using the provided Pi 5 image, it will already autoboot.

If not (Make sure to change any home directory paths appropriately for your own system):

Create a start_kraken.sh script in /boot:

#!/bin/bash

# This script is run on startup by a systemd service at /lib/systemd/system/krakensdr.service

cd /home/krakenrf/krakensdr_doa
./kraken_doa_start.sh

Create a systemd service called krakensdr.service in /lib/systemd/system/krakensdr.service:

[Unit]
Description=Start KrakenSDR Code
After=multi-user.target

[Service]
Type=forking
Workingdirectory=/home/krakenrf/krakensdr_doa
ExecStart=/usr/bin/sh /boot/start_kraken.sh

[Install]
WantedBy=multi-user.target

Make the service boot on every restart:

sudo systemctl daemon-reload
sudo systemctl enable krakensdr.service

Finally, in kraken_doa_start.sh, comment out the eval line, and uncomment the source line:

source /home/krakenrf/miniforge3/etc/profile.d/conda.sh #<- required for systemd auto startup
#eval "$(conda shell.bash hook)"
conda activate kraken
ChandraOrbit commented 1 month ago

OK, I've tried it and it works Thank You