PASOS PARA INICIAR APLICACIONES AL MOMENTO QUE SE INICIA EL SERVIDOR UBUNTU
First of all, you're going to need root access.
1. Find the location of the program you wish to run at bootup. For example, MyProgram is located in
/home/me/programs/MyProgram
2. We need to create a script file in the init.d folder and we need superuser privileges for that.
2a. Run the command
sudo touch /etc/init.d/RunMyProgram
It'll prompt you for the root password, enter it. Make sure the file has been created in that directory.
2b. Make the file executable.
sudo chmod +x /etc/init.d/RunMyprogram
3. Open that file in a text editor (nano /etc/init.d/RunMyProgram)
4. We're going to create a simple script that will simply call our program. Type this bit of code in that text file. Replace the second line with the file path for your program. That is all that should be in the text file.
#!/bin/bash
/home/me/programs/MyProgram &
4a. This script will automatically run as root. If you want your program to run as a standard unprivileged user, put in a 'su ' before the second line.
5. We need to assign our script to a certain runlevel (at what state in Linux's bootup you wish to run the program).
5a. Simply run
sudo update-rc.d /etc/init.d/RunMyProgram defaults
and that will put you at the appropriate runlevels.
jueves, 5 de noviembre de 2015
Suscribirse a:
feeds
0 comentarios:
Publicar un comentario