LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > MEPIS
User Name
Password
MEPIS This forum is for the discussion of MEPIS Linux.

Notices

Reply
 
Search this Thread
Old 11-29-2006, 10:29 AM   #16
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61

Joany,

I've had a chance to test this, only I created a link to start K3B and it worked. This is what I did:

Code:
$ ls -l
total 16
-rw-r--r--  1 jobob jobob 4464 Nov 27  2004 Autorun.desktop
$
$ln -s /usr/bin/k3b /home/jobob/.kde/Autostart/k3b_st
$
$ ls -l
total 16
-rw-r--r--  1 jobob jobob 4464 Nov 27  2004 Autorun.desktop
lrwxrwxrwx  1 jobob jobob 12 Nov 29 09:20 k3b_st -> /usr/bin/k3b
$
When I login it runs K3B automatically. I hope this helps.

Regards,
Fordeck
 
Old 11-29-2006, 11:18 AM   #17
joany
LQ Newbie
 
Registered: Nov 2006
Posts: 15

Original Poster
Rep: Reputation: 0
fordeck -

Thanks for the info in your last two postings.

In your example, you established a link between the file "vmware" and the executable "vmware-tools":

ln -s /usr/bin/vmware-tools /home/username/.kde/Autostart/vmware

I have a question: Could "vmware" be any type of file, or must it also be executable and contain script that calls vmware-tools?

I finally found out why my text file "vmware" wasn't executing. First, I forgot to insert the header line !#/bin/bash above the script that tells the sytem that the script is a shell code. Second, I had to make vmware executable by changing the mode using the chmod command in the terminal:

$ chmod +x vmware

Now /home/username/.kde/Autostart/vmware will execute the shell code when I sign on as username. So it looks like both of us came up with a similar solution.

Again, thanks for your helpful advice.
 
Old 11-29-2006, 11:37 AM   #18
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Joany,

As for your question:
Quote:
I have a question: Could "vmware" be any type of file, or must it also be executable and contain script that calls vmware-tools?
In your solution it is a shell script which as you pointed out had to be made executable. One word of caution in naming conventions, just be sure that your filename is not the same as another file in your path. That can lead to confusion and depending on how it is called may not execute the intended file.

Example:
One mistake that is made is for a user to name their file "/home/username/test". Now when they try to execute it by entering its name test, what actually gets executed is /usr/bin/test because /usr/bin is in their path.

A symbolic link is basically just a pointer. In this case a pointer to the executable /usr/bin/vmware-tools. But again the same caution should be used when naming your symbolic links.

Anyway I'm glad you have a working solution now.

Regards,
Fordeck
 
Old 11-29-2006, 03:07 PM   #19
tytower
Member
 
Registered: Jun 2006
Location: Oz
Distribution: Mandriva 10.0,10.1,10.2,2006,Mepis 6.0,Opensuse10.2,Puppy 2.14
Posts: 250

Rep: Reputation: 30
At the start you were looking for ".profile" file
In Mepis its called ".bash_profile"
To see it you must have the view set to show hidden files

I wanted my email to start at each boot so I named a new text file "MyStartupScript.sh" . I put the fo;;owing in it:-
!#/bin/bash
kmail

I placed that file in /home/userame/.kde/Autostart and I changed its permissions to be executeable
Worked like a charm.

Last edited by tytower; 11-29-2006 at 03:29 PM.
 
Old 11-30-2006, 11:32 AM   #20
joany
LQ Newbie
 
Registered: Nov 2006
Posts: 15

Original Poster
Rep: Reputation: 0
Questions for tytower

Thanks for identifying .bash_profile. I have some questions about how I might use this file.

First of all, I found three files with that name:

/root/.bash_profile
/home/username/.bash_profile
/etc/.bash_profile

Are any of these files supposed execute while MEPIS boots up? On my system all three files are identical -- they're just plain text -- and do not appear to be executable. Would I have to use the chmod command to make them executable?

Second, these files contain just a single line:

. ~/.bashrc

Doesn't a shell script normally start with:

#!/bin/bash

or something similar to that??

I guess I'm trying to figure out what, if anything, these files are used for or how I might put them to use.

I appreciate any further information you may have on this.

Thanks,
joany
 
Old 11-30-2006, 01:15 PM   #21
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Quote:
Are any of these files supposed execute while MEPIS boots up?
~/.bash_profile is executed or read whenever the user logs in. There are serveral files that bash consults when starting up, depending on whether the shell was called at login or from within another shell.

From "man bash" on login shells:

...it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile in that order, and reads and executes commnads from the first one that exists and is readable. When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

As for your question about #!/bin/bash. That statement as the first line in a file tells the kernel which shell to use when executing this file. This is because linux has numerous shells (i.e. bash, ksh, csh, zsh etc..)

If a file doesn't have this first line and is not executable, you can still feed the commands to a shell like this "/bin/bash <script> for example:

Code:
$ls -l
-rw-rw-r--  1 jobob jobob  151 Nov  6 19:49 rute2.sh
$
$cat rute2.sh
echo " I will work out X*Y"
echo " Enter X"
read X
echo " Enter Y"
read Y
echo "X*Y = $X*$Y = $[X*Y]"
$
$
$/bin/bash rute2.sh
 I will work out X*Y
 Enter X
15
 Enter Y
15
X*Y = 15*15 = 225
$
$
Notice that rute2.sh is not executable, and the results of cat rute2.sh shows the commands that are listed in the file. The statement "/bin/bash rute2.sh" executes those commands.

I hope this helps. If you have any more questions let me know.

Regards,
Fordeck

Last edited by fordeck; 11-30-2006 at 01:16 PM.
 
Old 11-30-2006, 04:43 PM   #22
joany
LQ Newbie
 
Registered: Nov 2006
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks, fordeck.

Your latest post cleared things up a lot for me. I've learned that there are many different ways in Linux to get the same thing done!
 
  


Reply

Tags
autostart, boot, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
newbie - how to create a startup script gogogadgetearl Linux - Software 2 10-02-2005 08:14 PM
Trying to create a startup script for tuxnes emulator Kilahchris Linux - Software 1 10-28-2004 05:27 AM
How To Create a DOS Startup Disk in linux? hari_seldon99 Linux - Software 2 07-01-2004 02:23 AM


All times are GMT -5. The time now is 05:47 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration