Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 18.04: startup SH script without GUI?

  1. #1
    Join Date
    May 2018
    Beans
    19

    18.04: startup SH script without GUI?

    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!!!

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: 18.04: startup SH script without GUI?

    Thread moved to General Help.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: 18.04: startup SH script without GUI?

    Hi gilius2. Welcome to the forum

    There are a few options:
    1. Create a systemd service (complicated).
    2. Call your script in /etc/rc.local (risk of your system not properly booting).
    3. 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.

  4. #4
    Join Date
    May 2018
    Beans
    19

    Re: 18.04: startup SH script without GUI?

    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?

  5. #5
    Join Date
    Aug 2013
    Beans
    4,328

    Re: 18.04: startup SH script without GUI?

    Quote Originally Posted by gilius2 View Post
    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!!!
    No, not in gnome shell. This is by design (for what purpose other than generating user frustrations I cannot tell)

    Edited: papibe's way would work by basically bypassing the DE but it is more complicated.

  6. #6
    Join Date
    Aug 2013
    Beans
    4,328

    Re: 18.04: startup SH script without GUI?

    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.

  7. #7
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,189

    Re: 18.04: startup SH script without GUI?

    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?

  8. #8
    Join Date
    May 2018
    Beans
    19

    Re: 18.04: startup SH script without GUI?

    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.

  9. #9
    Join Date
    May 2018
    Beans
    19

    Re: 18.04: startup SH script without 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.

  10. #10
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,189

    Re: 18.04: startup SH script without GUI?

    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

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •