Running a program on startup
I have a program I have made, and I would like it to run as soon as the system is finished booting. I am using Ubuntu Mini Remix to recreate a LiveCD/USB stick. After booting, it drops me to a command line where I can enter "sudo qct" and it will run my program (which is called qct, and it has to be run as root).
I want this to be automated. Instead of going to a command line, I want it to run the program itself at that point. How would I go about doing this? I have read many tutorials about scripting but I cannot seem to get it to work. |
Hello,
Click on System, Preferences, Sessions, and from there, select the "Startup Programs" tab, and you can add your program to be ran on boot. Cheers, Josh |
This distro is command-line only, no GNOME or Unity.
|
Ahh ok, that explains it :p
Does your distro contain the /etc/rc.d/init.d/ directory? It should, but I have never used your distro.... You could always move your script into that directory, then create links to your runlevel directories, such as /etc/rc.d/rc5.d/ and so forth. Or you could just move the script to /etc/rc.d/rc.local. Cheers, Josh |
There is:
/etc/init.d/ /etc/rc0.d/ /etc/rc1.d/ /etc/rc2.d/ /etc/rc3.d/ /etc/rc4.d/ /etc/rc5.d/ /etc/rd6.d/ /etc/rdS.d/ there is a rc.local file in /etc/ The script I am trying to run is this: Code:
#!/bin/bash |
Well in order to run it as root, you will have to manually enter your root password. Since you said your distro is command line only, you could place your script name within rc.local and go from there.
|
So I would add a line containing "/etc/rc2.d/qctrun.sh" to rc.local?
|
You can place your script anywhere, just make sure that your script is chmod'd to execute.
Code:
(in rc.local) Cheers, Josh |
Just put /path/to/qct into /etc/rc.local before the final line exit 0 and it will be run as root after everything else has booted up. You'll have to adjust the path to your command, don't take "/path/to/" literally. Example:
Code:
#!/bin/sh -e Try it out. See if it works. |
Quote:
|
Greatly appreciate the assistance, guys. Trying it out now to see if I can get it working :p
|
Now it doesn't even boot as far as the command line. It sits at the ubuntu loading screen endlessly filling the same dots with orange and then white :(
It is probably trying to do what I told it to do, but I cannot see. |
All times are GMT -5. The time now is 04:50 PM. |