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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

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

  • 30-03-2012 1: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.


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,048 ✭✭✭✭Johnboy1951


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


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 453 ✭✭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


Advertisement