Autostarting Apps and Scripts in KDE
If, after booting your Linux system, you routinely find yourself manually starting certain applications, or using the command line to set up hardware (configuring wireless devices, etc.), the method given here will reduce your workload by automating these tasks\' execution.
Recently, I was working in the guts of a SLAX distro. The computer used a new 802.11N wireless card, and the user wanted its MAC address randomized at boot time. The computer was also set up to use a powersaving scheme, configured with a set of manually entered commands at boot time. Then there was the nifty little trick of bringing up a favorite internet radio station in Firefox.
All of these tasks can be accomplished manually in about two minutes if one clicks and types quickly and makes no errors. Adding some commands to the file /etc/rc.d/rc.local automates things but requires creating or editing a Slax module to make it persistent. Could there be a simple way to run a script or start a program that involves less effort and reduced chances of breaking the system in the event of errors?
Yes, automatic running of user scripts or starting chosen apps can easily be accomplished by using the "Autostart" folder. Scripts placed in the system\'s ~/.kde/Autostart directory will be run at boot time. Symbolic links to apllications can be placed there, and the applications will be opened at boot time.
There are two ways to populate the Autostart directory. First, will be an example using the
command line, to bring up a well known internet browser. Open a Konsole and change to the KDE autostart
$ cd ~/.kde/AutostartThen create a symbolic link to the executable (location of executable first, then a name for the symlink):
$ ln -s /opt/firefox/firefox firefox
In the event that the application needs specific command arguments, create a shell script in ~/.kde/Autostart as shown in this example:
#!/bin/sh /usr/local/sbin/airdriver-ng load 16 end
Make the script executable, and it should work upon next boot-up.
The other method of populating the Autostart folder is by working in a graphical (KDE) environment, using a right click inside "Autostart" --> Create New --> Link to Application. Again, for a series of commands or specific parameters, put a script in "Autostart" and it will run at boot time.
For SLAX based systems, the "rootcopy" folder is a great place to set up autostarting. One could create a script /rootcopy/.kde/Autostart/airdriver.sh and see the effect upon next boot - without having to create a loadable module.
In conclusion, the techniques given above enable one to increase computing efficiency by automating many of the repetitive tasks often accomplished manually at boot time. Some systems also support the use of a rootcopy directory for testing or making temporary changes, while loadable modules are a more persistent method of setting autostart events.
Tags: linux, kde, autostart, start at boot, linux tweaks, kde tweaks