Results 1 to 3 of 3

Thread: Run a command when gnome loads (before user login)

  1. #1
    Join Date
    Sep 2006
    Beans
    28
    Distro
    Ubuntu 9.10 Karmic Koala

    Run a command when gnome loads (before user login)

    I've got a command I need run before gnome loads, but I'm confused about a few things reading the man pages for update-rc.d. I don't understand what it means when it says that admins shouldn't use it to manage runlevels. And what is all this about links?

    My command: /usr/bin/xgamma -rgamma 0.73 -ggamma 0.40 -bgamma 0.88

    I've spend almost 2 hours trying to get this command to run at startup using the System->Sessions window cause it took forever to figure out that Ubuntu did not like "> /dev/null" at the end of the command for some reason. I finally got it running without that part, but in the end that method sucks because the colors are off on the login screen, so that's why I'm looking into update-rc.d.

    Anyway, I'd appreciate a better explanation of update-rc.d and runlevels than the man pages gives, and also an explanation why the autorun setup didn't like the "> /dev/null" in the command so hopefully I can get it working before gnome loads and learn a few things in the process.
    Last edited by KyferEz; March 22nd, 2009 at 12:51 AM.

  2. #2
    Join Date
    Sep 2006
    Beans
    28
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Run a command when gnome loads (before user login)

    noone?

  3. #3
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,438
    Distro
    Lubuntu 16.04 Xenial Xerus

    Re: Run a command when gnome loads (before user login)

    I think that this may be what you're looking for.

    Read sections 9.3 and 9.4 carefully.

    http://www.debian.org/doc/debian-pol...tml#s-sysvinit

    Give it a try.

    In short (as I understand), you'll want to create a file in directory /etc/init.d (let's say you call it gamma) that contains the following:
    Code:
    #!/bin/sh
    echo -n Starting gamma...
    /usr/bin/xgamma -rgamma 0.73 -ggamma 0.40 -bgamma 0.88
    echo Done.
    Set the permissions:
    Code:
    sudo chmod +x gamma
    Test the script before proceeding!

    Then register it to run.
    Code:
    sudo update-rc.d -n gamma start S .
    Note two things:

    1. There is a "." at the end of the line.
    2. The -n option indicates a test (a "dry-run"); update-rc.d will simply tell you what it would do, so it's safe to try. If you're happy with what it reports, then run it for real by omitting the -n option.

    Let me know if it works, I'm curious.

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
  •