MEPISThis forum is for the discussion of MEPIS Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
How do I create a startup script to run an application in background during/after booting up? The application in question is already installed. I presently use a desktop icon to launch it immediately after booting up, but I really would rather have it launch itself automatically. Does this have anything to do with "daemons" and such?? Please provide a step-by-step example of how to do this, since I am quite new to Linux and need a lot of hand holding at this stage!
Thanks for getting back to me. I opened a terminal and typed "locate .profile" and got hits on a number of files in the form *.profile, including one named "/usr/share/base-files/dot.profile"
When I open the file in a text editor, there is a header that says:
"# ~/.profile: executed by Bourne-compatible login shells."
Is this the file I should try to append? What is the proper syntax for a line of script that starts an application from this file? For example, if the terminal command to start the application is "vmware-tools," is that all I need to append to the script? Or should the syntax be: "vmware-tools start" in the script?
I'm sorry for asking such stupid questions, but as I said earlier, I need a lot of help at this stage.
The .profile I spoke of would be in your user's home directory for example:
This file is ran everytime you login. You could append something like this to the bottom of .profile:
if [ -x /<path-to-vmware-tools>/vmware-tools ]; then
However this approach could cause problems. Like I said earlier .profile gets executed everytime you login. A better approach would be to create a PID or process id file when vmware-tools starts, and have the script check for its existence. I'll have to see if I can create something that would do that.
Thanks for your time and trouble. I log in as "username", but unfortunately, I cannot locate a file named /home/username/.profile on my system.
It may be that Mepis uses a different naming convention for the profile file than the distro you're using. I'll try adding the lines of code you suggested in your last post into the /usr/share/base-file/dot.profile file and see what happens. Having the code run every time I log in should not be a problem.
As you might have guessed I'm running Mepis on a virtual machine (VMware) instead of from a full install, so there's no harm in trying this out. I'm presently taking Mepis for an extended "test drive" before doing a full install. So I'll back up my virtual file system and if things get out of hand and "blow up," I can easily restore everyting back to normal from the back up copy.
Your right, I don't use Mepis so maybe they do it differently. You could also create one in your home directory and see if that works. The file you mentioned above /usr/share/base-file/dot.profile is probably a template file for users personal .profile files. You probalbly already know this but just in case. Files that begin with a "." are hidden files and can be listed by:
You may be quite right about the /usr/share/base-file/dot.profile being only a "template" file. I'll try creating a new hidden file named /home/username/.profile containing the lines of code you suggested in your 11-22-06 5:22PM post. I'm at a friend's house and will get back to testing Mepis on my computer next Monday. I'll post the results early next week.
Following your suggestion, I created a file named /home/username/.profile and wrote the following lines of code using a text editor:
if [ -x /usr/bin/vmware-tools ]; then
I verified that the .profile file had been saved in the proper folder, then I rebooted the machine and logged in as username. Unfortunately, it seems that the script I wrote in the .profile file failed to execute during the sign-on sequence, because vmware-tools wasn't running and I had to start it manually.
One other possibility might be to use "/etc/rc.d/rc.local". This path is relative to a Fedora installation. Your rc.local might be in another location. The rc.local file is executed after all other runlevel scripts have run at bootup. Again this file only runs at system bootup. Also it would probably be a good idea to run vmware-tools in the background so one small modification to the code:
if [ -x /usr/bin/vmware-tools ]; then
Thanks once again for your trouble. I agree that it would be preferable to run vmware-tools in the background, and I'll add the "&" to the code to do that.
I did some research and learned that by default, VMware is supposed to automatically launch while the Linux guest OS boots. But it seems that Mepis doesn't fully support all of VMware's features, which is why I'm having this problem. It could be that Mepis uses different startup files than the other distros.
I won't have time to try out your most recent suggestion until tomorrow -- I'll post the result then.
I located a file named /etc/rc.local. The file header states that the script is executed, "At the end of each multiuser run level."
There is another file named /etc/init.d/rc.local. The script contained in that file calls /etc/rc.local, so I thought the logical choice was to insert the script that launches vmware-tools into /etc/rc.local. Using root privileges, I edited /etc/rc.local, saved the file, rebooted, and logged in under username. As before, vmware-tools was not running after I logged in and I had to start it manually.
Finally, I said, "What the heck," and inserted the script to launch vmware-tools into /etc/init.d/rc.local, saved the file, rebooted and logged in. Same result: Vmware-tools was not running.
At this point, I'm not at all sure that my script is even being accessed during boot-up or logging in. Is there some way to display some sort of message or banner that would verify that the script I added is actually being read? That could help pinpoint whether there is a problem with the script itself or if the script simply is being ignored.
This has been quite educational for me, even though we haven't solved the problem!
It seems that with Mepis, any executable files that are saved in the folder /home/username/.kde/Autostart will start automatically when "username" logs in.
Now my question is how can I create a script file (from scratch) that launches itself from that folder? Can one use any text editor (like GEDIT) to create such a script file, or is a special editor required? How should I save such a file; i.e., what is the convention for naming executable script files?
I used GEDIT to create a file named "vmware" with script code in it. Then I saved this file into the Autostart folder. However, when I logged in, GEDIT launched itself and displayed the text in the "vmware" file, instead of executing the script that I wrote in the file.
I think I'm close to finding the solution to this problem and I'm sure the solution will turn out to be fairly simple, but I could definitely use some more help at this point.