Automatic StartupHow can I make a program start up automatically after the computer starts/restarts/boots/reboots?
Instructions for MS Windows:In the Start menu, click "All Programs", then double-click "Startup". The Startup folder opens when you double-click it. Place a Shortcut to the program into this folder. Shortcuts are created by second-clicking on a file and then clicking "Create Shortcut". Advanced users only: If you want to run it as a Service, see the MS Windows Service page. Unfortunately this is much more difficult due to the poor design of this operating system.
Instructions for MacOS X:Please see the MacOS X Auto Startup page.
Instructions for MacOS 9:Find the folder named "Startup Items" inside your "System Folder". Place an alias to the program into this folder.
Instructions for GNU/Linux:These instructions are for starting a command-line server program such as KDX Server for GNU/Linux. We will use KDX Server for this example. Unfortunately these instructions are terribly long and detailed due to the poor design of this operating system (just be thankful that you did not have to work this all out by yourself!). 1. Establish a shell/terminal session to/on your GNU/Linux computer. 2. For improved security, we recommend that you create a new user that is only used for running KDX Server (KDX Server will be run as this user). Enter the "su" command to switch to root user, and then the "adduser" command to create a new user. In the following steps, we will assume that you named the user "kdxuser".
su 3. Make a folder/directory that will contain the KDX Server program and its associated files/folders. It will probably be located at: /home/kdxuser/kdxservfolder/ su kdxuser 4. Use the methods of your choice to download the KDX Server program from www.haxial.com, unzip the archive, and place the executable file ("KDXServer.lexe") into the "kdxservfolder" folder, so it will probably be located at: /home/kdxuser/kdxservfolder/KDXServer.lexe 5. When the computer starts, it will be running as root, but we want to run KDX Server as "kdxuser". To do this, turn on the "suid bit" for KDXServer.lexe. This means that when the file is executed, it will be executed as whichever user owns the file. Here are the commands to turn on suid and set the owner: cd ~/kdxservfolder 6. Next you are required to write a shell script that will be executed by the "rc" system when the computer starts. We have written one for you, but you may need to make some minor changes. [View] [Download] If it looks evil, that is because it is. SuSe 9.1 USERS: The above script does not work for SuSe. Please use this SuSe script instead. Note that you will need to edit the KDXUSER_ID and KDXGROUP_ID lines. This script was contributed by Ola. Thanks Ola. 7. In the script, where you see the following line, change the path to the location of your copy of the program file ("KDXServer.lexe"). PROGRAMFILE=/home/kdxuser/kdxservfolder/KDXServer.lexe 8. If you are running only 1 copy of KDX Server, then you can leave the following line in the script unchanged. But if you are running multiple copies, then each will need its own script file with a unique ".pid" name in the following line (for example, you might name it "KDXServer1.pid", "KDXServer2.pid", etc). PIDFILE=/var/run/KDXServer.pid 9. We have named the script file "S99kdxserver.sh". You can change the name but it must begin with "S99". 10. The script file must be located in the /etc/rcS.d/ folder. (Note: It would probably make more sense for it to be located in "rc3.d" but for some strange reason, this did not work, so use "rcS.d".) Use the method of your choice to place the script file at: /etc/rcS.d/S99kdxserver.sh Or you can use the evil "vi" command to create the file as follows. 11. Start vi using the following commands: cd /etc/rcS.d 12. Press the 'a' key (without return) to start appending text ('i' is for inserting). 13. Type or copy&paste the script text. 14. Press the ESC key when you are finished. 15. Type :wq and press return (including the colon) to save the file and exit vi. 16. You can optionally use the "more" command to verify that the file contains what you want. The 'q' key exits the "more" command (if it did not exit automatically). more S99kdxserver.sh 17. The script file must have Execute permission. Enter this command: chmod u+x S99kdxserver.sh 18. Done! That wasn't nearly as painful as sliding down a 30 meter razor blade using your balls as brakes, what was I complaining about? To test whether it all worked (unlikely), you can use the "shutdown" command (the -r option makes it restart). shutdown -r now19. If the Great Lord of the Bits in the Sky is not displeased, then when the computer eventually returns, KDX Server will start automatically, being run as the user of your choice. You can use the "ps" command to check whether it is running (or just try connecting). ps aux
1. Establish a shell/terminal session to/on your Gentoo Linux computer. 2. For improved security, we recommend that you create a new user that is only used for running KDX Server (KDX Server will be run as this user). Enter the "su" command to switch to root user, and then the "adduser" command to create a new user. In the following steps, we will assume that you named the user "kdxuser".
su 3. Make a folder/directory that will contain the KDX Server program and its associated files/folders. It will probably be located at: /home/kdxuser/kdxservfolder/ su kdxuser 4. Use the methods of your choice to download the KDX Server program from www.haxial.com, unzip the archive, and place the executable file ("KDXServer.lexe") into the "kdxservfolder" folder, so it will probably be located at: /home/kdxuser/kdxservfolder/KDXServer.lexe 5. Use the "su" command again to switch the root user, then create a text file named "kdxserver" in the /etc/init.d/ directory. Put this script in the file (beware that some of the lines are so long that they may be wrapped/displayed on 2 lines here, but they are actually 1 hard line): #!/sbin/runscript But change the KDX_USER, KDX_GROUP and PROGRAM_FILE lines to be correct for your system. 6. The script file must have Execute permission. Enter this command: chmod +x /etc/init.d/kdxserver 7. Now you have a service named "kdxserver". To make this server run by default when the computer is started, use this command: rc-update add kdxserver default 8. In future, to manually start, stop, or check the status of the "kdxserver" service, use one of these commands: /etc/init.d/kdxserver start
|