In 18.04 GUI I can add a .SH file to the Startup Programs via the menus in the top-right. However, does anyone know how I might get a script to automatically run at startup without the GUI and no interaction? ANY HELP WOULD BE MUCH APPRECIATED!!!
In 18.04 GUI I can add a .SH file to the Startup Programs via the menus in the top-right. However, does anyone know how I might get a script to automatically run at startup without the GUI and no interaction? ANY HELP WOULD BE MUCH APPRECIATED!!!
Thread moved to General Help.
Hi gilius2. Welcome to the forum
There are a few options:
- Create a systemd service (complicated).
- Call your script in /etc/rc.local (risk of your system not properly booting).
- RECOMENDED: create a crontab using @reboot
Example:
Code:@reboot /path/to/your/script.sh
You may need to modify your script since you'll loose some of the obvious things, like where the script it is executed (use absolute paths), some programs won't available unless you call them using absolute paths, etc.
Hope it helps. Let us know how it goes.
Regards.
Thanks for your reply, but I forgot to mention: I am a complete noob. What is crontrab? And how to create exactly on Ubuntu? Does it work on 18.04 version?
Well would making a .desktop file (a "gui" as you called it) be acceptable to you? That would be the easiest way. I thought you meant you don't want a "GUI", maybe you just meant it doesn't have one.
so the script runs an application that has a gui/window that loads when run, that you want to suppress/minimize/close?
can you post the script?
It's a script that runs a QEMU virtual machine, but I want to suppress the Ubuntu Desktop GUI so I can run it headless. In other words, I want to turn of X11 and still run a startup script/application that starts a spice server or VNC/SSH server. But I want to try to achieve all this without any interaction, i.e. no SSH connection/login needed and certainly no Desktop GUI.
Win7.sh
#!/bin/bash
cd /mnt/media_rw/D6A29B84A29B682F
sudo insmod kvm.ko
sudo insmod kvm-intel.ko
sudo qemu-system-x86_64 \
-m 2047 -smp 2 \
--usbdevice tablet -net nic,model=virtio \
-drive file=w7s.img,format=raw,cache=none,if=virtio \
-vga qxl -cpu host -enable-kvm \
-net user,hostfwd=tcp::5555-:3389,smb=/storage/emulated/0 \
-spice port=5900,addr=127.0.0.1,disable-ticketing
That starts my VM on Ubuntu 18.04 via LinuxDeploy on my ASUS Zenfone 2. I can then connect using a Spice Client (ASPICE), but the only problem is I need to run an additional app to display the GUI otherwise I cannot get the script started by itself.
i can think of 2 options right now.
1. uninstall the login screen/app & setup a xinitrc
https://wiki.ubuntu.com/CustomXSession
2. create a custom session you can select at the login screen
https://help.gnome.org/admin/system-...custom.html.en
Bookmarks