I wrote a small compose program with tray icon for vpn management, how can I have it run automatically on boot?
I'm on Ubuntu (and it's supposed to be linux-only), I tried the following on `crontab -e`:
@reboot /home/elect/IdeaProjects/easnx/run.sh
but nothing runs..
elect
04/11/2024, 10:27 AM
script is dead simple
Copy code
#!/bin/bash
cd /home/elect/IdeaProjects/easnx
./gradlew run
and works flawless if called manually
s
Sam
04/11/2024, 10:33 AM
I think systemd will work. Look for some instructions on making a systemd service. Basic principle is to create a
.service
config file for it, and then use
systemctl enable myservice
.
r
Robert Williams
04/11/2024, 10:41 AM
systemd is indeed the best option most of the time if you actually require it to run on boot. Depending on what your program does though, it may be simpler/ more appropriate to run it on login to your graphical Desktop session. You can configure Startup Applications in Gnome Tweak Tool (or equivalent for different DEs)