LinuxQuestions.org
Visit Jeremy's Blog.
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 04-04-2007, 02:37 PM   #1
bhert
Member
 
Registered: May 2006
Distribution: OpenSUSE 10.3 Kubuntu Hardy Heron
Posts: 268

Rep: Reputation: 30
create a line automatically at every reboot


Hello, I have a problem, I installed quake for linux and there was no sound at start of the game. I found out that if i add a line: echo fuhquake-gl.glx 0 0 direct > /proc/asound/card0/pcm0p/oss in /proc/asound/card0/pcm0p/oss, the game works with sound. The only problem is when I reboot, the line is gone from the file. What is the best way to have the line added to the file automatically when I reboot? Do I create an autostart script? I don't think the .kde/autostart will work because you have to be root to do this. I could be wrong. Help please. I don't want to have to add the line manually everytime I boot. Thanks.

-bhert
 
Old 04-04-2007, 03:01 PM   #2
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
sysctl is your friend.

See man sysctl for more info
 
Old 04-04-2007, 03:11 PM   #3
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Put it in the rc.local file is one way:
Code:
if [ -d /proc/asound/card0/pcm0p ]; then
  echo "fuhquake-gl.glx 0 0 direct" > /proc/asound/card0/pcm0p/oss
fi
 
Old 04-04-2007, 05:24 PM   #4
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Quote:
See man sysctl for more info
I may be wrong, but I don't think that's relevant here. From man sysctl:

"sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/."

The OP wants to edit the /proc/asound branch.

Last edited by bsdunix; 04-04-2007 at 05:25 PM.
 
Old 04-05-2007, 01:19 AM   #5
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
sorry my bad
 
Old 04-06-2007, 06:41 PM   #6
bhert
Member
 
Registered: May 2006
Distribution: OpenSUSE 10.3 Kubuntu Hardy Heron
Posts: 268

Original Poster
Rep: Reputation: 30
Thanks for replying bsdunix, I am using suse so there is no rc.local in /etc/init.d
However, there is rc in /etc/init.d which contains rules for daemons. Can I add the line to it?
Thanks,

-bhert
 
Old 04-07-2007, 08:27 AM   #7
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
If there is no rc.local in /etc or /etc/rc.d (if you have
a /etc/rc.d), then use /etc/init.d/boot.local file. It's
been a long while since I used SuSE. Apparently,
boot.local is the replacement for rc.local file.
 
Old 04-07-2007, 04:03 PM   #8
bhert
Member
 
Registered: May 2006
Distribution: OpenSUSE 10.3 Kubuntu Hardy Heron
Posts: 268

Original Poster
Rep: Reputation: 30
bsdunix, I do have boot.local in etc/init.d
I added the script and it wouldn't work after I rebooted
I even added my command and still didn't work
What could be wrong?
Is there another way it can be accomplished? Thanks

-bhert
*EDIT* Could it be permissions? boot.local is set at 744

Last edited by bhert; 04-07-2007 at 04:05 PM.
 
Old 04-07-2007, 10:02 PM   #9
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Quote:
I added the script and it wouldn't work after I rebooted
I installed OpenSUSE 10.2 (very nice) and sure enough the darn boot.local file won't work. After much trial and error I was able to get it to work using after.local file (which I had to create). I found out about that file by looking at the /etc/init.d/rc script.
Code:
# cd /etc/init.d
# touch after.local
# chmod 744 after.local
# vi after.local
Enter the following text, save, and reboot:
Code:
#! /bin/sh
#
# /etc/init.d/after.local
#
#
# Here you should add things, that should happen directly
# after run level is reached.
#

if [ -f /proc/asound/card0/pcm0p/oss ]; then
  echo "fuhquake-gl.glx 0 0 direct" > /proc/asound/card0/pcm0p/oss
fi
Verify it worked:
Code:
# cat /proc/asound/card0/pcm0p/oss
fuhquake-gl.glx 0 0 direct
I hope you have success now.

Last edited by bsdunix; 04-07-2007 at 10:07 PM.
 
Old 04-08-2007, 09:59 AM   #10
bhert
Member
 
Registered: May 2006
Distribution: OpenSUSE 10.3 Kubuntu Hardy Heron
Posts: 268

Original Poster
Rep: Reputation: 30
Thanks so much bsdunix You are a lifesaver! Now I can add other scripts and make things easier for me.

I looked at rc with vim and used search and sure enough after.local is there

I looked at boot.local and it starts before the first runlevel. That's why it didn't work

after.local starts after the runlevels are done. That's why it works.

It takes a little time to get used to suse, but it's a very nice distro. Glad you like it too.

Once again, thanks for all your help

Cheers

-bhert
 
  


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
automatically reboot padideh Linux - Server 7 10-12-2006 05:54 AM
How to reboot linux machine automatically kum4363 Linux - Newbie 8 07-29-2005 01:51 PM
Ubuntu won't reboot automatically Marrea Ubuntu 0 07-22-2005 04:25 AM
Gnome failed to start automatically on reboot moacirponti Red Hat 0 09-08-2004 04:00 PM
device icons created automatically after reboot mushmaster Linux - Newbie 2 08-14-2004 07:00 PM

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

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