LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-08-2003, 11:17 PM   #1
cephlon
LQ Newbie
 
Registered: Oct 2003
Location: Chicago
Distribution: Suse
Posts: 17

Rep: Reputation: 0
run script at startup in suse 8.2


Hello. I have the following script in my /etc/rc.d and my /etc/init.d/ folder. It is called boot.smbmount.
I even tried linking it to a file in rc3.d.
The script works fine if I run it from terminal, but how can I get it to execute on start up?
Thanks for any Help.


Code:
#! /bin/sh
#
# Smb Mount
#
mount -t smbfs -o username=Administrator,password=nothing //bilbo/shared /home/elbow/share/bilbo
echo "Bilbo Mounted"
 
Old 12-09-2003, 12:17 AM   #2
stuNNed
Member
 
Registered: Aug 2003
Distribution: Gentoo/Ubuntu
Posts: 134

Rep: Reputation: 15
call it like an init script like the others in that same dir are called?

i.e. model it after the other init scripts
 
Old 12-09-2003, 06:13 PM   #3
cephlon
LQ Newbie
 
Registered: Oct 2003
Location: Chicago
Distribution: Suse
Posts: 17

Original Poster
Rep: Reputation: 0
Sorry, I dont completlu understand.
I know what you mean by call in a general sense, but what does it mean here?
How exactly are the scripts called at startup?
Thanks

 
Old 12-09-2003, 06:17 PM   #4
stuNNed
Member
 
Registered: Aug 2003
Distribution: Gentoo/Ubuntu
Posts: 134

Rep: Reputation: 15
scripts in /etc/init.d or /etc/rc.d are run at startup, take one of those scripts which is pretty simple and standard and model your init script after it. place your actual script in /usr/local/bin or the like then when the system boots up, it will run the script you created in /etc/init.d and point to the script in /usr/local/bin

...I'm not too familiar with how SuSe has their init scripts, I know in Gentoo, everything is pretty much handled by what's in /etc/init.d
 
Old 12-09-2003, 06:54 PM   #5
cephlon
LQ Newbie
 
Registered: Oct 2003
Location: Chicago
Distribution: Suse
Posts: 17

Original Poster
Rep: Reputation: 0
Man, sometimes the most obvious is what I overlook...
Looking at the other files helped set me on the right track.
I will detail my solution so that others running Suse can benefit.

Suse says the start up scripts are in etc/rc.d, but from what I can tell, etc/rc.d and etc/init.d are exact mirrors of eachother. When I change a file in one location it is changed in the other.

I added two lines to the code:

Code:
#! /bin/sh
#
# Smb Mount
#
# Source SuSE config
. /etc/rc.status

mount -t smbfs -o username=Administrator,password=barney //bilbo/shared /home/elbow/share/bilbo
echo "Bilbo Mounted"


rc_exit
I added: . /etc/rc.status at the beginning and
rc_exit at the end.
I am not sure what these lines do yet, I will look into that later. But all the other boot scripts in etc/rc.d had these lines.
Then I put the script in etc/rc.d, I think you could put it anywhere though, like in /usr/local/bin as stunNed stated.
Then create a link to rc5.d like this:
Code:
#ln -s /etc/rc.d/boot.smbmount /etc/rc.d/rc5.d/S99boot.smbmount
When I restarted it was working fine.
Hope that helps someone,
Thanks for the help StuNNED
 
Old 05-22-2004, 12:41 AM   #6
Rico16135
Member
 
Registered: Aug 2003
Location: Texas, USA
Distribution: Slackware 9.1, SuSE 9.1
Posts: 245

Rep: Reputation: 30
From my understanding, in SuSE (9.1 at least), scripts you wish to use for startup/shutdown should be put in init.d (or perhaps a kron job is in order?) rc.d is a symbolic link to init.d in a sense, they are the same file. I think they do that so programs looking for rc.d or programs looking for init.d all get to the same spot.

within init.d/rc.d the different folders correspond to runlevels. The default runlever for SuSE is 5. (i may be wrong, but I'm pretty sure)

Symbolicy linking your script from init.d/rc.d into the runlevel you wish will cause your script to be executed when that runlevel has been called, so to speak. (changing the name of a symbolic link does not change the name of the original file, content I think will change) The K in front of some of the filenames indicates that particular script will be executed when the runlevel shuts down. It stands for kill. The S stands for start. The number following is what order it will be executed. 01 being first 99 being last.

Now what needs to be inluded within your script is something I'm a little sketchy on, but I'll follow up after I refresh my memory.

Last edited by Rico16135; 05-22-2004 at 12:43 AM.
 
Old 05-22-2004, 01:35 AM   #7
Rico16135
Member
 
Registered: Aug 2003
Location: Texas, USA
Distribution: Slackware 9.1, SuSE 9.1
Posts: 245

Rep: Reputation: 30
Also, there is a readme concerning what we're talking about, located at : /etc/init.d/README
It is there on 9.1, so for earlier versions, I can't verify its existence.
 
  


Reply



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 On
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
Run Script at Startup?? usaf_sp SUSE / openSUSE 5 11-11-2005 01:43 PM
get a script to run on startup kram Debian 3 04-23-2005 02:23 PM
Run a script at startup iain.ross Linux - Newbie 8 08-27-2004 04:03 PM
How to run script on startup Angelis Linux - General 1 11-16-2003 05:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:41 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration