Results 1 to 4 of 4

Thread: Shell script runs on startup when going to Startup Applications in UI, fails rc.local

  1. #1
    Join Date
    Apr 2013
    Beans
    3

    Shell script runs on startup when going to Startup Applications in UI, fails rc.local

    using Ubuntu 12.10 64 bit


    I wrote a small shell script that sets up my resolution for my second monitor. When I put it in Startup Applications (through the unity interface) the script is run. However, I am trying to avoid using the UI and do everything through terminal.


    When I edit my /etc/rc.local file and put


    /home/anvils/resolution.sh


    in the line before "exit 0", it changes nothing when I reboot.


    I have also tried to put it in my /etc/init.d/rc.local file but it doesn't do anything either.


    Why does the script work on startup when I put it in Startup Applications through the UI but not when I edit the rc.local file? Also, how can I make it work just by doing terminal commands?

  2. #2
    Join Date
    Jun 2006
    Location
    Antarctica
    Beans
    500
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Shell script runs on startup when going to Startup Applications in UI, fails rc.l

    I guess rc.local are run even before X is launched. Also you should try 'disper' when playing with multi-monitors. It's very simple to use.

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Shell script runs on startup when going to Startup Applications in UI, fails rc.l

    Quote Originally Posted by dargaud View Post
    I guess rc.local are run even before X is launched.
    +1
    The rc.local script is run before the X server starts, so if any of the commands in your script need X to be up and running then they won't work.
    If you can post the contents of your script then it will make it easier for us to diagnose.

    Also is your home folder encrypted? If it is then this will stop the script from running because your home directory doesn't get unlocked until you log on, which again happens later in the boot process than the rc.local script gets executed.

    If you want to add the script to your startup applications without using a GUI, then just create a link or copy it into your ~/.config/autostart directory.
    Cheesemill

  4. #4
    Join Date
    Apr 2013
    Beans
    3

    Re: Shell script runs on startup when going to Startup Applications in UI, fails rc.l

    Apologies for being late on the reply.

    Extra information: When I posted this, my desktop environment was Unity. I have recently did a command-line install of ubuntu and tried to copy my file into the ~/.config/autostart in both LXDE and Gnome 3. It did not work either way.

    Extra note: On the command line installation, I could not find the .config directory. When I installed the DE, I could find the .config folder but not the autostart directory. When I run the script on its own, it works. However, it does not work on reboot.

    The file is as follows:

    #!/bin/bash
    xrandr --newmode "resolution1" ... [modeline numbers]
    xrandr --addmode VBOX0 resolution1
    xrandr --output VBOX0 --mode resolution1

    It works when I run the file, but it doesn't work on reboot.

Tags for this Thread

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
  •