Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

alsaproblems (want it for voicecommand)
Thank you for your donation

Pages (2): « Previous 1 2
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
alsaproblems (want it for voicecommand)
21st Jan, 2014, 09:23 PM
Post: #16
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
Sorry, didn't see your post until now...

If you are still interested, here's a template: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
22nd Jan, 2014, 03:13 AM
Post: #17
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(21st Jan, 2014 09:23 PM)josch Wrote:  Sorry, didn't see your post until now...

If you are still interested, here's a template: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/

Okay, thanks a lot but I don't understand the script (still A kinda a noob)
Can you help me adjust it ?
Find all posts by this user
Quote this message in a reply
22nd Jan, 2014, 11:07 PM
Post: #18
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
Here you go, I made a small startscript extra for you that is using screen to keep voicecommand running.

You need 'screen' installed to use it. If it's not, just run:
Terminal
sudo apt-get install screen


Then, to create the script just run:
Terminal
sudo nano /etc/init.d/voicecommand

Then paste in:
Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides: voicecommand
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start voicecommand via screen.
# Description: Start voicecommand via screen to keep running.
### END INIT INFO

USER=xbian
APP=voicecommand

case "$1" in
start)
if ! screen -list | grep -q $APP; then
  echo "Starting $APP"
  screen -dmS $APP su -c $APP $USER
else
  echo "$APP already running"
  exit 1
fi
;;

stop)
echo "Stopping $APP"
screen -S $APP -X quit
;;

*)
echo "Usage: voicecommand {start|stop}"
exit 1
;;
esac

exit 0
(Press Ctrl+O and Ctrl+X to save and close.)

Finally run:
Terminal
sudo chmod +x /etc/init.d/voicecommand
sudo update-rc.d voicecommand defaults


That's it. Reboot and voicecommand should autostart and keep running.

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
22nd Jan, 2014, 11:10 PM
Post: #19
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(22nd Jan, 2014 11:07 PM)josch Wrote:  Here you go, I made a small startscript extra for you that is using screen to keep voicecommand running.

You need 'screen' installed to use it. If it's not, just run:
Terminal
sudo apt-get install screen


Then, to create the script just run:
Terminal
sudo nano /etc/init.d/voicecommand

Then paste in:
Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides: voicecommand
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start voicecommand via screen.
# Description: Start voicecommand via screen to keep running.
### END INIT INFO

USER=xbian
APP=voicecommand

case "$1" in
start)
if ! screen -list | grep -q $APP; then
  echo "Starting $APP"
  screen -dmS $APP su -c $APP $USER
else
  echo "$APP already running"
  exit 1
fi
;;

stop)
echo "Stopping $APP"
screen -S $APP -X quit
;;

*)
S=/etc/init.d/${0##*/}
echo "Usage: $S {start|stop}"
exit 1
;;
esac

exit 0
(Press Ctrl+O and Ctrl+X to save and close.)

Finally run:
Terminal
sudo chmod +x /etc/init.d/voicecommand
sudo update-rc.d voicecommand defaults


That's it. Reboot and voicecommand should autostart and keep running.

How do you mean keep it running, I got a system witch kills it and restart it with a drifrent flag, so it won't interrupt with that?
Find all posts by this user
Quote this message in a reply
23rd Jan, 2014, 02:41 AM
Post: #20
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
I solely mean that it will autostart when booting. Of course you can kill it.

Terminal
sudo service voicecommand stop
will do the work. This will kill the screen session via
Terminal
screen -S voicecommand -X quit


But why there is something running that will kill and restart it with different flags?
When does this happen? Why don't just start it with the right flags?

Let me know and I can help you.

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
23rd Jan, 2014, 02:54 AM
Post: #21
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(23rd Jan, 2014 02:41 AM)josch Wrote:  I solely mean that it will autostart when booting. Of course you can kill it.

Terminal
sudo service voicecommand stop
will do the work. This will kill the screen session via
Terminal
screen -S voicecommand -X quit


But why there is something running that will kill and restart it with different flags?
When does this happen? Why don't just start it with the right flags?

Let me know and I can help you.
thanks a lot : the reson why is :
-f means diffrent VOC (voicecommand ) config file,
so i can make a menu.
for example i need to enter an vocal authorization code for shutdown.
in the main file i put shutdown==sudo killall voicecommand && sudo voicecommand -f/root/.shutdown.conf
in the conf i put
autorization code==sudo halt
see?
Find all posts by this user
Quote this message in a reply
23rd Jan, 2014, 05:14 AM
Post: #22
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
So instead of sudo killall voicecommand you have to run sudo screen -S voicecommand -X quit if it's running in it's own screen session. (like from my startscript)

But one question: When your script ist just calling sudo voicecommand -f/root/.shutdown.conf, will it run in the background?
If so, there is no need for screen. I used it, because you said that you have to keep the terminal open to keep it running.

Anyhow, if you want to do exactly the same what you are doing now but within screen, just do:

shutdown==sudo screen -S voicecommand -X quit && sudo screen -dmS voicecommand voicecommand -f/root/.shutdown.conf
instead of
shutdown==sudo killall voicecommand && sudo voicecommand -f/root/.shutdown.conf

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
23rd Jan, 2014, 05:34 AM
Post: #23
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(23rd Jan, 2014 05:14 AM)josch Wrote:  So instead of sudo killall voicecommand you have to run sudo screen -S voicecommand -X quit if it's running in it's own screen session. (like from my startscript)

But one question: When your script ist just calling sudo voicecommand -f/root/.shutdown.conf, will it run in the background?
If so, there is no need for screen. I used it, because you said that you have to keep the terminal open to keep it running.

Anyhow, if you want to do exactly the same what you are doing now but within screen, just do:

shutdown==sudo screen -S voicecommand -X quit && sudo screen -dmS voicecommand voicecommand -f/root/.shutdown.conf
instead of
shutdown==sudo killall voicecommand && sudo voicecommand -f/root/.shutdown.conf
What is the -dmS?
And the sudo nohup voicecommand keeps it in background
Find all posts by this user
Quote this message in a reply
23rd Jan, 2014, 08:33 PM
Post: #24
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
(23rd Jan, 2014 05:34 AM)lukeg01 Wrote:  What is the -dmS?

Terminal
xbian@xbian ~ $ screen -h
Use: screen [-opts] [cmd [args]]
or: screen -r [host.tty]

Options:
[...]
-dmS name Start as daemon: Screen session in detached mode.
[...]



(23rd Jan, 2014 05:34 AM)lukeg01 Wrote:  And the sudo nohup voicecommand keeps it in background

Okay, so just use screen instead of nohup. That way you can use my startscript and you're able to get into the running session whenever you want with:
Terminal
sudo screen -r voicecommand
To exit the session again (but keep running), press Ctrl+a and then d


As it seems that you want to run voicecommand as root, remember to change the USER var in the startscript to root.
Of course, you could even just delete the USER var and replace screen -dmS $APP su -c $APP $USER with screen -dmS $APP $APP

And here again your commands to kill and start again with other configuration:
kill
Terminal
sudo screen -S voicecommand -X quit
start with custom conf
Terminal
sudo screen -dmS voicecommand voicecommand -f /your/custom/configfile

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
26th Jan, 2014, 03:58 AM
Post: #25
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(23rd Jan, 2014 08:33 PM)josch Wrote:  
(23rd Jan, 2014 05:34 AM)lukeg01 Wrote:  What is the -dmS?

Terminal
xbian@xbian ~ $ screen -h
Use: screen [-opts] [cmd [args]]
or: screen -r [host.tty]

Options:
[...]
-dmS name Start as daemon: Screen session in detached mode.
[...]
sudo killall voicecommand still works, is it a problem if i keep using killall?

luke



(23rd Jan, 2014 05:34 AM)lukeg01 Wrote:  And the sudo nohup voicecommand keeps it in background

Okay, so just use screen instead of nohup. That way you can use my startscript and you're able to get into the running session whenever you want with:
Terminal
sudo screen -r voicecommand
To exit the session again (but keep running), press Ctrl+a and then d


As it seems that you want to run voicecommand as root, remember to change the USER var in the startscript to root.
Of course, you could even just delete the USER var and replace screen -dmS $APP su -c $APP $USER with screen -dmS $APP $APP

And here again your commands to kill and start again with other configuration:
kill
Terminal
sudo screen -S voicecommand -X quit
start with custom conf
Terminal
sudo screen -dmS voicecommand voicecommand -f /your/custom/configfile
Find all posts by this user
Quote this message in a reply
26th Jan, 2014, 05:33 AM
Post: #26
josch Offline
Registered
Posts: 85
Joined: Jan 2014
Reputation: 17
RE: alsaproblems (want it for voicecommand)
The problem with killall is, that it will kill die voicecommand running in the screen session but it won't kill the screen session itself.
So better kill the whole screen session if you don't need it anymore. But yes - if you are going to start voicecommand in the same
screen session again anyway, you can use killall. But then you have to start voicecommand that way:

Terminal
screen -S voicecommand -X stuff 'voicecommand'`echo -ne '\015'`
(not tested, just got it from: http://superuser.com/questions/116743/send-command-to-an-already-running-screen-session)

My setup:
Software: XBian version: 1.0RC3 | XBMC version: 13.2 (Gotham) | Overclock settings: High
Hardware: RPi model: B | Power: DUB-H7 | SD: Tanscend Class 10 | Network: Wireless
Find all posts by this user
Quote this message in a reply
26th Jan, 2014, 05:41 AM
Post: #27
lukeg01 Offline
Registered
Posts: 77
Joined: Dec 2013
Reputation: 1
RE: alsaproblems (want it for voicecommand)
(26th Jan, 2014 05:33 AM)josch Wrote:  The problem with killall is, that it will kill die voicecommand running in the screen session but it won't kill the screen session itself.
So better kill the whole screen session if you don't need it anymore. But yes - if you are going to start voicecommand in the same
screen session again anyway, you can use killall. But then you have to start voicecommand that way:

Terminal
screen -S voicecommand -X stuff 'voicecommand'`echo -ne '\015'`
(not tested, just got it from: http://superuser.com/questions/116743/send-command-to-an-already-running-screen-session)

Well than I'll keep it at kill all sins there is always a active instance of voicecontrol
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (2): « Previous 1 2
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 20th May, 2025, 05:00 AM Powered By MyBB, © 2002-2025 MyBB Group.