0

I think I'm starting to go mad. I have tried several things by now, and nothing works.

This is on an Ubuntu 22.04 LTS Desktop Version.

I tried this guide: https://www.baeldung.com/linux/run-script-on-startup

My script file is a quite simple, start chromium-browser in kiosk mode with this IP / page.

chromium-browser -kiosk -incognito https://google.com

Saved this file as tiles.sh in /usr/local/ Then I chmod +x tiles.sh

First option I have tried: crontab -e | where I added:

@reboot root /usr/local/tiles.sh

2nd thing I tried was to add it to .profile in the home folder on the bottom line. Nothing...

sh /usr/local/tiles.sh

I have then tried to use Ubuntu's built in "Startup Application Preferences", again nothing... https://itsfoss.com/manage-startup-applications-ubuntu/

Name; Tiles, Path: /usr/local/tiles.sh, I didn't add any comments.

4th thing was with a tiles.service added to the systemctl

[Unit]
description=Tiles
[Service]
Type=simple
ExecStart=/bin/bash /usr/local/tiles.sh
[Install]
WantedBy=multi-user.target

chmod 644 /etc/systemd/system/tiles.service

systemctl enable tiles.service

systemctl start tiles.service

reboot


So, can someone please tell me what I'm doing wrong here?

Edit:

  • So I fixed a copy-paste error with missing /, so the path looked incomplete

  • A comment suggested that 'crontab -e' is only for 'on boot' stuff, so this wouldn't work.

5
  • You need an absolute path to your script, then Startup Applications should work just fine.
    – pLumo
    Commented Nov 6, 2023 at 14:53
  • Please avoid commenting on your own question. To add new information or update, please edit your question instead.
    – user535733
    Commented Nov 6, 2023 at 15:19
  • 1
    Does this answer your question? How to run scripts on start up? Commented Nov 7, 2023 at 7:33
  • The approaches are wrong. A GUI program can only be started with the GUI running / having the desktop available. systemd units start too early. Recommendation is to create a .desktop file which is executed by the desktop environment once its started.
    – noisefloor
    Commented Nov 7, 2023 at 8:37
  • You should post your solution as an "answer" below and press a checkmark next to it. Don't add "solved" to the title and don't edit the question with the solution. Commented Nov 7, 2023 at 9:22

2 Answers 2

2

Cron has its own PATH, which is hard coded and set to:

/usr/bin:/bin

This means that only programs installed in those two directories can be launched by name through cron. Firefox is installed at /usr/bin/firefox, so firefox is enough for cron to find it, but chromium is installed as a snap package and is most likely at /snap/bin/chromium. This means your script can't find it as chromium and instead needs the full path. It should work if you change your script to:

/snap/bin/chromium-browser -kiosk -incognito https://google.com

In general, you can run type command to find the path to a command. So type chromium-browser will give you the path to the executable.

0

The fix was to sudo apt purge chromium-browser -y and switch to firefox

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .