Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Automate a script to start on reboot ?

  1. #11
    Join Date
    Sep 2015
    Beans
    132

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by Lars Noodén View Post
    By what symptoms does it show that it has failed to run?
    If the script would have run, my page would have opened which is dependent on it.
    But it failed.

    And I had to start it manually with the same command.
    So, I said, it failed.

  2. #12
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    4,953

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by soamz View Post
    my page would have opened which is dependent on it.
    If you want a script that (for example) opens a web page, that is a post-login task, not a boot task. Very different.

    All boot tasks (including rc.local and cron @reboot) must be headless - no display. Boot output is logged instead of displayed.
    Any display-related actions or scripts before login will always fail, regardless of how you initiate them. Including rc.local and cron.
    Reason: The display server isn't started until after login is successful.

    Instead, try putting your script in your ~/.config/autostart/ directory.
    Items in ~/.config/autostart/ are run after login, after the display server and Desktop Environment are up and running.
    The script should run without sudo. Items run as your user, since they are within your user's environment.

    When troubleshooting startup scripts of any kind, outputting debug messages to logfiles (instead of the screen) can be a very handy technique to find the problem.
    Last edited by ian-weisser; November 29th, 2015 at 09:30 PM.

  3. #13
    Join Date
    Sep 2015
    Beans
    132

    Re: Automate a script to start on reboot ?

    Is basically, the script has to run and thats it.
    Because, if it runs successfully automatically, then the job is done.

    When it runs, then the process starts.
    I test it by going to a URL. If it opens, that means the process is running. If its not, that means its not working.

    So where to place finally ?

  4. #14
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by soamz View Post
    I test it by going to a URL. If it opens, that means the process is running. If its not, that means its not working.

    So where to place finally ?
    That kind of test will only work from an active graphical log in. What you might do is put something in your script that does not need a graphical login to see if it has run. Try adding at the end of your script, something like this:

    Code:
    /bin/date > /tmp/foo.txt
    and then see if there is a file called /tmp/foo.txt after you boot.

  5. #15
    Join Date
    Sep 2015
    Beans
    132

    Re: Automate a script to start on reboot ?

    Here is what I do now :
    When the server reboots, i do this :

    cd /usr/software

    then
    ./ooklaserver.sh start


    Then it says, starting daemon and it starts and when I refresh the page on browser, its opening.


    So, which file shall I paste this exact code ?

  6. #16
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Automate a script to start on reboot ?

    It would go in the file ooklaserver.sh

    but can you run the script as /usr/software/ooklaserver.sh directly instead of using cd? Or must it be in the same working directory?

  7. #17
    Join Date
    Sep 2015
    Beans
    132

    Re: Automate a script to start on reboot ?

    You mean edit ooklaserver.sh using sudo nano and enter what ?

  8. #18
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    4,953

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by soamz View Post
    So, which file shall I paste this exact code ?
    It's hard for us to answer that question...because it's entirely the wrong question.

    Did you try ~/.config/autostart?

  9. #19
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    4,953

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by soamz View Post
    So, which file shall I paste this exact code ?
    It's hard for us to answer that question...because it's entirely the wrong question.

    Are you running an Ookla server?
    Or are you querying an Ookla server for ping or speedtest data?

  10. #20
    Join Date
    Sep 2015
    Beans
    132

    Re: Automate a script to start on reboot ?

    Quote Originally Posted by ian-weisser View Post
    It's hard for us to answer that question...because it's entirely the wrong question.

    Did you try ~/.config/autostart?

    Okay will sudo nano /.config/autostart

    and paste this,

    /usr/software/./ooklaserver.sh start

Page 2 of 3 FirstFirst 123 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
  •