Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How do I run a script automatically at startup using Lubuntu?

  • 30-03-2012 02:06PM
    #1
    Registered Users, Registered Users 2 Posts: 53
    ✭✭


    I'm new to Linux but I love it's speed on my old PC which I use to run a projector on.

    I installed Lubuntu 11.04 on it.

    I'm using my Android phone with the Gmote app to control the mouse when I'm watching stuff on the projector.

    But I am having problems getting the Gmote server to launch automatically when I boot Lubuntu.

    I have written a simple script that works just fine when I manually run it but using suggestions from other forums I have failed to get this script to run by itself at boot.

    Can anyone give me a step by step guide of what to do in order to get the Gmote server to launch at startup? Keep it simple cause I'm not really clued into Linux terminology.

    The script I need to run automatically is this: (it works fine and is saved as gmotelaunch.sh on the desktop:

    #!/bin/sh
    cd /home/aa/Downloads/GmoteServerLinux2.0.0
    ./GmoteServer.sh



    Thanks in advance.


Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Registered Users, Registered Users 2 Posts: 218 Tillotson
    ✭✭


    There's probably an Ubuntu way to do this through menus but adding this
    ~/Downloads/GmoteServerLinux2.0.0/GmoteServer.sh &
    
    to the bottom of ~/.xinitrc should work.

    Try logging out and in of X to test.


  • Registered Users, Registered Users 2 Posts: 53 cisco27
    ✭✭


    Tillotson wrote: »
    There's probably an Ubuntu way to do this through menus but adding this
    ~/Downloads/GmoteServerLinux2.0.0/GmoteServer.sh &
    
    to the bottom of ~/.xinitrc should work.

    Try logging out and in of X to test.


    i just tried your suggestion but it didn't work for me. any other ideas?


  • Registered Users, Registered Users 2 Posts: 2,719 ARGINITE
    ✭✭✭


    For simple things you can add a command in System->Preferences->Sessions pointing to the location of your script.


  • Registered Users, Registered Users 2 Posts: 5,238 humbert
    ✭✭✭


    Typically it involves putting a script in /etc/init.d/
    Often the window manager/desktop environment has a method of running scripts when you log in.

    Putting it in ~/.xinitrc wouldn't work if you are launching the x server as root, i.e., when the system starts...I think.

    Probably the simplest way is using cron like this:
    http://jonathonhill.net/2009-08-18/easy-startup-scripts-using-crontab/
    More info here:
    https://help.ubuntu.com/community/CronHowto

    Make sure your script is executable. I.e. chmod +x yourscript.

    Oh, and there's no need to change directory before calling the script, just use the absolute path.


  • Registered Users, Registered Users 2 Posts: 14,084 Johnboy1951
    ✭✭✭✭


    I usually put such scripts in the Autostart directory .....


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 454 Ant
    ✭✭


    I'd agree with humbert's suggestion that /etc/init.d/ is probably the best way to go about it as the Gmote server will start on bootup even if you don't log on.

    Others seem to have had success with this approach.


  • Registered Users, Registered Users 2 Posts: 1,606 djmarkus
    ✭✭✭


    put it in /etc/rc.local


  • Registered Users, Registered Users 2 Posts: 854 human 19
    ✭✭✭


    I use KDE and I saved a script in the hidden folder /home/*****/.kde/Autostart/ to stop kde blanking the screen every 10 mins.
    It worked


Welcome!

It looks like you're new here. Sign in or register to get started.
Advertisement