How can I script an autologin, automatically call kde(or simillar) and call an app
Hi all,
I have an application that should start without user interference. We'd like to make an automatic login with an user without password, start kde and call the application. And, if it it's possible, when my application is finished, ask if shutdown the system will be done. Can I write these instructions at rc.local, for example ? Thanks. |
Try it in rc.local. You might find these complications:
1. When you start kde, you'll have to figure out a way to know it's all the way up before running the application. I can't help you with that. Maybe you can time how long it normally takes kde to come up, and double that just to be sure. 2. Once you know that kde is up, don't just start the application. Wrap a script around that which (1) runs your application, and (2) asks whether the system should be shut down. Step 2 should be done so that the question is visible on the kde screen. To do that, put the asking of that question in a separate script (let's assume that the script is called fred), and run that by doing something like this: Code:
xterm -e /bin/bash -c /fullpath/fred 3. If your application is to run as anything other than root, instead of just running the application, you'll need to explicitly run it as the intended user. Since you're already root when you're running rc.local, you won't need to supply a password. Just use the sudo command: Code:
sudo -u username /fullpath/application_name Code:
env | sort | less 5. If you do everything exactly as outlined above, you'll have yet another problem: you don't want to hang out in rc.local forever while the application is running; you want it to run to completion before the system comes up. In face, you'll probably want it to run to completion before you start your application. To make sure that it doesn't wait around for your application to exit before rc.local continues (and eventually exits), place everything described above except the starting of kde in a separate script, and call that from rc.local as follows: Code:
/etc/rc.d/rc.startmyapplication & To make sure that rc.local is effectively finished before you run your application, place all of this (except possibly the startup of kde) at the very end of your rc.local. Obviously, you should remember to make all your scripts executable: Code:
chmod 700 /etc/rc.d/whateverscript Hope this helps. |
Hi !
First of all, thank you very much for your support about my doubts. I believe it will help me lot. But I will need to study and analize your post with care. I a beginner, so... :confused: Thanks. |
Caution: I have corrected my usage of the "sudo" command.
|
id:3:initdefault:
That line in /etc/inittab if U change it to id:4:initdefault: Then it will auto load into run level 4, auto starting your default WM if u using KDE as your default WM (desktop, whatever) then, now (after the /etc/inittab change) u logon via KDM (KDE desktop display manager) Next, in KDE go to its control center wherein you can opt to auto logon a user (user doesn't need to enter username and password to logon) -- to opt for this, it will prompt u for super user mode or u opt for super user mode then enter the root password in order to make these changes. al@P3box ~$ cd .kde al@P3box ~/.kde $ pwd /home/al/.kde al@P3box ~/.kde $ ls | grep Auto /Autostart In that Autostart folder underneath the .kde folder -- any .desktop (dot_desktop) put in that folder autostarts the corresponding app Now boots, auto logs on the user to KDE, auto starts desired app (Do not do this at a business where you do not want other people having access to your files/data (desktop). -- Alan. |
Alans ideas above are good, except I wouldn't use a .desktop file to start the program. I would use something like
Quote:
Regards, Bill |
Note that a bash script should almost always begin with
Code:
#!/bin/sh Code:
#!/bin/bash |
OK, I've changed my post above, but just for that post. I never use any shell except bash, & I'm sure that most newbs don't either, so /bin/bash will work for a large majority of us all the time. But we must satisfy the nitpickers.
Regards, Bill |
Oh, (sorry) I missed the part about the OP request to shutdown the system.
If all you want to do is autostart a few apps, then, copied from the KDE help center: kdesktop in its turn automatically starts applications stored in $KDEHOME/Autostart. kdesktop will automatically open any files stored in this directory including documents, binary files or applications in the form of .desktop files. KDE Internals KSMServer That's the relevant section where I copied from the KDE help center. -- Alan. |
All times are GMT -5. The time now is 02:18 AM. |