Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    StartX command line script which logs out automatically after run


    Hi

    I don't want to use any desktop manager (KDM, GDM). I have a simple fluxbox desktop what I start with a script from command line.
    What I try to accomplish that after X is started it logs the deepconsole out automatically (for security reason).

    So how can you write a script which logs you out but don't kill the parent process. What I tried was:

    export DISPLAY=:0
    cd /home/user
    xinit -- :0 vt10 &
    disown
    kill -9 $(pgrep -u $(whoami) -t tty1 | head -1)

  2. #2
    Just Joined!
    Join Date
    May 2011
    Location
    Austin, TX
    Posts
    92
    look into: nohup, screen, tmux, or even vlock.

    nohup should be on any system and will prevent a hang-up from being sent to a process.

    screen and tmux accomplish things similar to each other and are very powerful beyond this - but could work for this also

    vlock would just allow you to re-'lock' that console.

  3. #3
    Linux Enthusiast
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    602
    dayid has got some good advices, and I'll have to check some of them out. Thank you dayid.

    Why call xinit? Just call the server explicitly in a login script, like:

    XPROG="/usr/X11R6/bin/XFree86" # or whatever
    TERMINAL="xterm" # or whatever
    if [ -z "$DISPLAY" ]; then
    SERVER=0 # or whatever
    ($XPROG -terminate -once &)
    (sleep 2; $TERMINAL -C -display :$SERVER &)
    fi

  4. $spacer_open
    $spacer_close

Posting Permissions

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