Results 1 to 9 of 9

Thread: how to autorun a script after login

  1. #1

    Default how to autorun a script after login

    I have a simple little script that I'm using to build a digital picture frame:

    #!/bin/sh
    #
    # Script to run Digital Picture Frame using Feh
    #

    # hide the cursor after 15 seconds
    unclutter -idle 5 &

    # Start slide show
    feh -q -Z -z -r -D 5 -F /home/dpf/photos &

    exit 0

    it runs great if I launch it manually from a terminal window, but how can I get it to launch automatically once the user dpf logs in?

    I have the YaST user settings such that dpf is the default user and logs in without a password.

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    435

    Default Re: how to autorun a script after login

    If you use kde, i suggest you copy your script in /home/dpf/.kde/Autostart (/home/dpf/.kde/Autostart if you use kde4) and make sure your script file is executable .

  3. #3

    Default Re: how to autorun a script after login

    the script file is named "start_frame.sh"

    by executable, do you mean setting the permissions using chmod?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,720

    Default Re: how to autorun a script after login

    The name does not matter and yes, you make something executeable by setting the appropriate x-bits with chmod.
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,925
    Blog Entries
    14

    Default Re: how to autorun a script after login

    which in your case would mean:
    su -c 'chmod +x start_frame.sh'
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,720

    Default Re: how to autorun a script after login

    Quote Originally Posted by Knurpht View Post
    which in your case would mean:
    su -c 'chmod +x start_frame.sh'
    Why the su? I do not see any mention of the fact that this script is owned by and/or should be run as root.

    It is his login as normal user and this user wants to run it and, as I read the OP, it is his script. No root involved IMHO.
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    435

    Default Re: how to autorun a script after login

    Quote Originally Posted by imatinkerer View Post
    tsetting the permissions using chmod?

    Yes, or simply right click the file in file manager (konqueror, dolphin, ...) and look for something like 'properties' and find a check box to tick the executable if needed.

  8. #8

    Default Re: how to autorun a script after login

    I can run the script manually without su, but if I need to make any modifications, then su is req'd

    thanks to all for the suggestions

    BTW: placing the script in the home/dpf/.kde4/Autostart directory worked!

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,720

    Default Re: how to autorun a script after login

    Quote Originally Posted by imatinkerer View Post
    I can run the script manually without su, but if I need to make any modifications, then su is req'd

    thanks to all for the suggestions

    BTW: placing the script in the home/dpf/.kde4/Autostart directory worked!
    I do not understand this. It is the script that dpff wants to be run. It is in dpfs' home directory. dpf is the one who made it (I hope). Is not dpf the owner of home/dpf/.kde4/Autostart/<thescript> ? That should be the case. And then no su (to root) is needed anywhere! And when root is not needed, it is a major sinn to run as root.
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •