As a regular user on Ubuntu 24 is there an alternative to `crontab` to run a command at `@reboot`?
Sep 24, 8:49am

Yes — the main alternative on Ubuntu 24 is a systemd user service (or timer). @reboot in cron is often unreliable anyway, since it runs before the network is up and, for user crontabs, only when the cron daemon decides.

Option 1: systemd user service (recommended)

Create the unit without root:

ini
# ~/.config/systemd/system/mytask.service
[Unit]
Description=Run my command at boot

[Service]
Type=oneshot
ExecStart=/usr/bin/mycommand

[Install]
WantedBy=default.target

Then:

bash
systemctl --user daemon-reload
systemctl --user enable mytask.service
loginctl enable-linger $USER   # optional but usually needed

Key point about linger: user services normally only start when you log in. If you want it to run at boot without logging in, run loginctl enable-linger <user> (this one command does require sudo, or another logged-in session's polkit approval).

Option 2: systemd user timer (if you want "shortly after boot" semantics)

ini
# ~/.config/systemd/system/mytask.timer
[Timer]
OnBootSec=1min
Unit=mytask.service

[Install]
WantedBy=timers.target
bash
systemctl --user daemon-reload
systemctl --user enable --now mytask.timer

This mimics @reboot (runs once per boot, after a delay so the system has settled) and also works without sudo, again with linger if needed.

Others (less recommended)

  • /etc/rc.local — requires root and is legacy.
  • A system-level systemd unit in /etc/systemd/system/ — requires sudo but runs as your user via User=.
  • GNOME Startup Applications (gnome-session-properties-style .desktop autostart) — runs at login, not boot.

For a regular user, the systemd user service/timer combo is the cleanest drop-in replacement for @reboot.

Sep 24, 8:49am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more