running a script on startup

Discussion in 'Linux' started by basily, Aug 26, 2009.

  1. basily

    basily

    Joined:
    Nov 12, 2008
    Messages:
    31
    Likes Received:
    0
    I have a small script file I made so that I can restore my items on the Thunar sidebar everytime I startup. When I run it manually, it works fine. I restart Thunar and all my sidebar items are restored. However I can't find a way to run this script on startup. I tried putting it in the "Autostarted applications" using the xfce4-autostart-editor, and it doesn't work.

    My script file is a single line (which I also tried to add to the Autostarted applications - also didn't work):
    cp /home/user/.gtk-bookmarks.copy /home/user/.gtk-bookmarks

    Can anyone help?
     
    basily, Aug 26, 2009
    #1
  2. basily

    bodhi.zazen

    Joined:
    Aug 6, 2009
    Messages:
    71
    Likes Received:
    0
    Put that single line in a file (I suggest you keep it in ~/bin) , all it fix.sh

    Code:
    #!/bin/bash
    cp /home/user/.gtk-bookmarks.copy /home/user/.gtk-bookmarks
    Now make it executable

    Code:
    chmod a+x ~/bin/fix.sh
    And add fix.sh to your Autostarted application, use the full path

    Code:
    /home/user/bin/fix.sh
    If it does not work, add a sleep

    Code:
    #!/bin/bash
    sleep 5
    cp /home/user/.gtk-bookmarks.copy /home/user/.gtk-bookmarks
     
    bodhi.zazen, Aug 26, 2009
    #2
  3. basily

    basily

    Joined:
    Nov 12, 2008
    Messages:
    31
    Likes Received:
    0
    THANKS!!! It was the sleep command that did it!
     
    basily, Aug 26, 2009
    #3
  4. basily

    bodhi.zazen

    Joined:
    Aug 6, 2009
    Messages:
    71
    Likes Received:
    0
    Glad it is working. If you have problems with it, increase the sleep to 10-15 seconds.
     
    bodhi.zazen, Aug 26, 2009
    #4
  5. basily

    basily

    Joined:
    Nov 12, 2008
    Messages:
    31
    Likes Received:
    0
    Thank you, yes, I did have to set the sleep to 8 for it to work.
     
    basily, Aug 27, 2009
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.