LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2004, 08:11 AM   #1
rohde
LQ Newbie
 
Registered: Oct 2003
Posts: 17

Rep: Reputation: 0
Script at startup


Hi,

I am experiencing some problems with the sound on my Suse 9.1 system.

On Suse's Linux Portal I found an article desrcibing the problem and providing a solution as well.

The solution was the following:

Firstly I needed to remove the kdemultimedia3-mixer package, and then at the consoe this:

rcalsasound stop
rm /etc/asound.state
rcalsasound start
alsactl store

Now the problem is that this works for this session as well as if I log out and log in again, but if I do a reboot I need to issue the commands above again in a shell.

Can I somehow execute this automatically upon reboot? Bear in mind I'm a newbie so I need some assistance on how to do this.
 
Old 09-12-2004, 09:08 AM   #2
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
Hi rohde!

I just happen to have a SuSE 9.1 Personal here (just trying it out, didn't say I like it, which I don't). I'll try to walk you through it.

This assumes that you are logged in as a normal user.

o Open a text editor ( Start > Utilities > Editor ) and enter the commands you want to be executed. The first line of the file should look like this:
Code:
#!/bin/sh
Save this file under some name you fancy (like myscript). Put it in your users home directory (for me, it's /home/martin )

o Open a terminal for root ( Start > System > Terminal > Terminal - Super User ) and enter the root password.

o Now, all startup scripts are placed in a directory called /etc/rc.d. Go there:
# cd /etc/rc.d

o Copy the script you just wrote here:
# cp /home/martin/myscript .
(Note the dot at the end. It's the destination of cp and means "current directory")

o We need to make the script executable:
# chmod 755 myscript

o Now, to make the script run at startup, you must make a symbolic link to it in rc5.d. To make a long story short, this is the directory that contains the scripts that are run in a normal boot into a graphical interface.
# cd rc5.d

o You may want to look at what's in this directory already. Not necessary, just out of curiosity:
# ls -alF
You see a lot of symbolic links to scripts in the parent directory (.. means parent)

o Make a symbolic link to your script:
# ln -s ../myscript S20myscript
The S is for a start script (as opposed to K, which are kill scripts) and the 20 is a number to order the scripts. The scripts with low numbers are run before scripts with high numbers.

Now, reboot and see if it works!

Good luck! Feel free to ask more if this doesn't work or is unclear to you.
Martin
 
Old 09-12-2004, 09:32 AM   #3
rohde
LQ Newbie
 
Registered: Oct 2003
Posts: 17

Original Poster
Rep: Reputation: 0
I love you Martin. It worked. Thanks a lot for guiding me through that. Not only did it work but it was very informative.

Thanks a bunch!
 
  


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 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
startup script rockwell_001 Linux - General 4 04-21-2005 04:22 PM
startup script ... again. Vindane Linux - Wireless Networking 2 03-04-2005 02:57 AM
startup script djinniyah Linux - Newbie 2 09-18-2003 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:53 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