2

In 2020 (last day today too), Fedora 33, what is the ideal way to run a command or script at startup?

I am asking this again because over the years I have seen several different ways of doing it, some of which are now obsolete, so in 2020, what is the ideal way to do this?

olfek
  • 731

3 Answers3

2

I was able to do this by creating my own .desktop file in ~/.config/autostart. I'm running Fedora Cinnamon Edition, not sure if this works in other distributions.

Example: Create a file named discord-desktop.desktop with the following content. On the restart, discord will start minimized.

[Desktop Entry]
Name=Discord Desktop
Comment=Discord Desktop for Linux
Exec=flatpak run com.discordapp.Discord --start-minimized
Type=Application
olfek
  • 731
1

I'd put the command in root user's crontab with @reboot directive, i.e.

@reboot /root/myscript.sh

It's a quick and easy way to put small, quick commands to run at startup.

Adrian
  • 2,526
  • 1
  • 11
  • 10
0
  • Create a systemd unit
  • put it into /etc/rc.d/rc.local (that's a file not a directory) and enable it:
sudo systemctl enable rc-local.service