YouTube | Webstore | Patreon | Twitter | Tip Jar | Linux 101
In order for the following to work, we need to install tmux. Tmux is used to run applications in the background. Install by running:
sudo apt update
sudo apt install tmux
Hint
You will need to replace YOURUSERNAME with your actual user name in several places below. To find your username, run
whoami
Now that we know who you are, run
cd ~/bin/
nano start-gateway
Now paste the following into the file and update YOURUSERNAME with your actual username.
#!/bin/bash
#script to start winlink gateway at boot. this
#script called by cron.
sleep 60
echo "starting vara fm"
tmux new -d -s varafm 'export DISPLAY=:0 && /usr/bin/wine $HOME/.wine/drive_c/VARA\ FM/VARAFM.exe'
sleep 7
echo "starting direwolf"
tmux new -d -s direwolf '/usr/local/bin/direwolf'
sleep 3
echo "starting linbpq"
cd /home/YOURUSERNAME/linbpq/
tmux new -d -s linbpq '/home/YOURUSERNAME/linbpq/./linbpq'
Now press ctrl+s to save and ctrl+x to exit
Next make the new script executable with
chmod +x start-gateway
The last thing is to tell cron to run the script at boot. Run
crontab -e
When the file opens, paste this at the bottom and update YOURUSERNAME with your actual username.
@reboot /home/YOURUSERNAME/bin/start-gateway
Now press ctrl+s to save and ctrl+x to exit
Be sure that direwolf, linbpq, and varafm are closed. You can test the script by running:
~/bin/start-gateway
Now reboot the machine. Once it comes back online, you should see VARAFM open on the desktop within two minutes. Assuming it does, run
tmux ls
Which will list out your tmux sessions. You should see three sessions listed.
varafm
direwolf
linbpq
If you want to attach to a session, you do that with
tmux a -t <session-name>
As an example, to attach to the direwolf session, run
tmux a -t direwolf
Don't close this window. Instead, you want to detach from it again by pressing ctrl+b (let go of those keys) and press "d".