You are not logged in.
This is something I've searched on various occasions and haven't been able to follow the answers and adopt them for my purposes.
I'm using oss instead of alsa. I won't go into the reasons for that here, but one of the shortcomings of oss is it doesn't survive being suspended, so you need to start it after suspending. What I would like is to work out a script that checks every couple of minutes whether oss is running and starts it if not, to save me the hassle if I forget to start it. The command to start oss is
sudo /etc/init.d/oss startand I have NOPASSWD set in the sudoers file.
As always, any help appreciated
Last edited by Obadobo (2012-11-28 17:38:39)
Offline
You can check for a process with pidof or pgrep. If you want your script to run in intervals you might want to look into cron/anacron. Can't really give you any more concrete advice at this time as I'm at work right now and don't have access to a #! machine where I could test this. If you google how to do it with pidof and how to use anacron I'm sure you'll figure it out in no time.
Offline
Thanks, rebornmechanics. I've never got my head round anacron - I'll have another google, but if anyone can point me to a really clear howto with examples that would be great.
The next problem is, though that oss doesn't seem to show as a process, even if it's running
ps aux | grep only returns
19894 0.0 0.0 3524 800 pts/1 R+ 12:30 0:00 grep -i osseven though it is running, as shown by:-
sudo /etc/init.d/oss start
Starting Open Sound System: OSS is already loaded.So that makes me even more mystified about how I would write a script which depends on whether it was running.
Last edited by Obadobo (2012-11-26 12:34:05)
Offline
Using alsa myself, I do not know what '/etc/init.d/oss start' does.
If it is like alsa, it just restores some volume levels and stops. So it might be impossible to check whether it is running or not. Perhaps '/etc/init.d/oss status' outputs something useful and could be run periodically?
Last edited by xaos52 (2012-11-26 12:36:37)
bootinfoscript - emacs primer - wireless problems- I ♥ #!
Offline
If it is like alsa, it just restores some volume levels and stops. So it might be impossible to check whether it is running or not.
Yes, I think you are right.
Perhaps '/etc/init.d/oss status' outputs something useful and could be run periodically?
There is ossinfo but it doesn't seem to report whether oss is running or not! I'm going to edit the subject because it seems that the problem is more specific to oss than I had anticipated
Offline
Offline
er - that seems to stop pm-suspend from working. But I have as /etc/pm/sleep.d/30oss4-pm the following
#!/bin/sh
#
# 99oss4-pm: Restart sound on suspend/resumt
case "$1" in
hibernate|suspend)
# We need to force unload in order
# to quit applications that are using oss4..
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d oss4-base force-unload
else
/etc/init.d/oss4-base force-unload
fi
;;
thaw|resume)
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d oss4-base start
else
/etc/init.d/oss4-base start
fi
;;
*) exit $NA
;;
esacLast edited by Obadobo (2012-11-26 14:32:17)
Offline
This is how I solved it:-
#! /bin/bash
sleep 5 && sudo /etc/init.d/oss start &
sudo pm-suspendMy keybind for suspend links to this script. So the computer waits 5 seconds to launch oss. Meanwhile it goes to sleep, so the 5 seconds finish after it wakes up. Seems to work fine 
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.