Created
August 12, 2009 21:44
-
-
Save dennyhalim/166797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://it.dennyhalim.com/2008/10/linux-automatic-login-startx-and.html | |
# paste into your ~/.bashrc and it just works. | |
# it will startx / startxfce when you login at tty1 | |
# it can also logout/shutdown after you close x. | |
file=/tmp/.X0-lock | |
#check if x is running | |
if [[ -e $file ]] | |
then | |
echo "Ctrl+Alt+F7 to switch to XWindow" | |
#only run X if login at tty1 | |
elif [ $(tty) == /dev/tty1 ]; then | |
startx | |
# exit #to logout automatically after x closed | |
#if you use exit and you have autologin, it loop and restart X | |
/sbin/halt #to shutdown automatically after x closed | |
#you should sudo chmod +s /sbin/halt for this to works correctly | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment