1

Tried to run batch script on terminal at startup using crontab and /etc/rc.local but they dont work. I dont know what has gone wrong as there is no log to check Here is the line on crontab @reboot user /home/user/script.sh ; /usr/bin/gnome-terminal -- bash -c "/home/user/script2.sh; exec bash" and on rc.local /home/user/script.sh ; /usr/bin/xterm -hold -e /home/user/script2.sh

2 Answers2

1

A terminal emulator such as xterm or Gnome Terminal can only run on a graphical server (Xorg or increasingly Wayland). There is no chance you can start that before the graphical environment has been setup.

During log in, however, you can automatically launch a terminal emulator. To keep the terminal open when the command has finished, you could add a "bash" command at the end so the terminal stays open at a bash prompt, or, in Gnome Terminal, edit the profile to specify that the terminal should remain open.

vanadium
  • 88,010
0

You can try creating a service as described here: https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6

Services are like "background jobs": they can be enabled to start on startup. I am not an expert, but I think cronjobs are more oriented to scheduled tasks (e.g. make a backup of the system every night at 2 a.m.).