Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So, first as an overview, this is what i would like my slack box to do:
-upon pressing power, it will automatically login as "student"
-x is started immediately with xmms run
-upon exiting xmms, x is closed
-user presented with 3 options:
1) return to xmms (easy enough, just startx)
2) logout
3) shutdown now
now i have tried calling testscript from inside .bash_profile, but it gives me a read error (this read error seems to occur when i try to execute this after leaving x)
if i add either the command "logout" or "shutdown now" after "startx in .bash_profile, they execute, but this is no good to me, as it leaves the user no options
when commenting out .bash_profile, and just going ./testscript, it tells me that shutdown is not a command, and that i must use "exit" not "logout", but (now correct me if im wrong), but it seems that by running a script you open a bash within bash? so by exiting, i am not logging out, only exiting the script?
again, that is just what i have tried, and it has yeilded mixed but ultimately confusing results. I'm certian I'm at fault, if someone could just tell me how, i would really appreciate it.
ALSO, as far as autologging in as a user, i got that to work with redhat 9.0 once upon a time, though i now forget how, so if someone could say how that is done in Slackware 10.0, i would appreciate it, but i think that is easy enough, i can probably figure that one out on my own, solving (or helping me solve) the above outlined problem is all im really after.
#!/bin/sh
xmms
echo "1 - Return to XMMS"
echo "2 - Logout"
echo "3 - Shutdown"
read var
case $var in
3) sudo halt ;;
2) exit ;;
*) xmms ;;
esac
If you have your system set up with xdm, gdm, or kdm, I think you could use the above or something similar in place of a window manager....everything in one file.
that didnt work very well. i changed to runlevel 5 (is that what you meant by set up with xdm,gdm, etc) (i have x windows, gnome and kde installed, if thats what you meant?)
if "1" -> wont run because youre not in x
if "2" -> command not found
if "3" -> commmand not found
i add you script to .bash_profile, is this the problem?
Maybe. You don't need .bash_profile or any startup script if you use something like the above script in place of a window manager. I didn't test it, though, so the syntax may be incorrect.
What I was trying to accomplish was this:
1) kdm, or whatever graphical session manager you have configured, is set to automatically log you in using this script in place of a window manager or desktop environment. I just boot into a text runlevel, though...not sure how to set up kdm to auto login.
2) The script runs, launching xmms.
3) If xmms is closed, the script continues with a choice of options. Choosing anything but 2 or 3 reloads Xmms.
I just whipped up the script off the top of my head, and didn't test it...now looking at it again, even if it does happen to work, it will only work once, because I didn't loop back to the biginning of the script after xmms is re-run.
It may need to be something like this:
#!/bin/sh
start_xmms () {
xmms
echo "1 - Return to XMMS"
echo "2 - Logout"
echo "3 - Shutdown"
read var
case $var in
3) sudo halt ;;
2) exit ;;
*) start_xmms ;;
esac
}
start_xmms
Again, syntax may be a little off, and I've never used numbers in a case, so that may be causing trouble.
Edit: Shoot....this doesn't give you a terminal in which to enter options....I'll have to rethink that.
Sorry for wasting your time.
To the best of my recollection, Slack doesn't use runlevel 5 for "automatically start an X-based DM (Display Manager, or more commonly "login manager"). When I was using Slack, runlevel 3 was the default, and I think runlevel 4 was the "x runlevel"-- if you look at /etc/inittab, the very start (of my backed-up one, at least says):
Quote:
# These are the default runlevels in Slackware:
# 0 = halt
# 1 = single user mode
# 2 = unused (but configured the same as runlevel 3)
# 3 = multiuser mode (default Slackware runlevel)
# 4 = X11 with KDM/GDM/XDM (session managers)
# 5 = unused (but configured the same as runlevel 3)
# 6 = reboot
Putting such a script in .bash_profile wouldn't help you, as afaik .bash_profile doesn't do that anyway (meaning, serve the function of running this script).
What mikshaw meant was that if you use such a DM as KDM, GDM or XDM, you should add this script to the "Sessions" folder, choose it from the Sessions menu when logging in, and make it the default session for the user when asked.
For GDM (which is the display manager I use under all distros I've ever used), you would want to:
1) Open a text editor as root.
2) Browse to /etc/X11/dm/Sessions and open one of the *.desktop files in the editor.
3) Edit the file to reflect a new name, description, and change the "Application=" field to point to the script.
4) Save the file aswhatever.desktop and exit the text editor.
Don't forget to make the script executable.
When you reboot, the new Session type should appear in the GDM sessions list, you can choose it, and you will be asked if you want to make it the default session after filling in your normal login details. This will allow you to retain the other sessions you may have installed (if you choose nothing from the login Sessions menu, the default will load, if you want to run a KDE session, you would then choose KDE from the Sessions menu.
Afaik, this should also work for KDM and XDM, as they both read the session list from /etc/X11/dm/Sessions as well.
GDM also allows you to set up a "custom" session, which will load the session found in ~/.xinitrc (which is on my system a symlink to ~./xsession). The traditional manner of creating a custom session is in fact to use ~/.xsession, but on my system, this is already used by ROX, so I had to create an additional session to run the script that I use to load Openbox3 (which is my default session, but runs from a script in order to load several programs automatically at startup).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.