Linux Auto start another program in the background
#1
Question 
Hi!

I have searched and attempted to try to work it out but couldn't get it to work. Any help would be greatly appreciated!

I am currently testing XBMCbuntu on VMware player to see if it is a viable solution for my HTPC setup. My main goal is to setup a hassle-free XBMCbuntu setup for the rest of the family, and dual boot into Windows for myself if I need to.

One important condition is that Soundwire has to work, and has to automatically start on boot. Soundwire is a program that streams audio wirelessly to android phones, and I use this as a wireless headphone.

I have verified the following:
- Soundwire server runs correctly and am able to connect a client to it.
- If I login as XBMCbuntu and run XBMC and the server, I can wirelessly stream audio

I have tried the following:
- created a .sh file that contains
Code:
#!/bin/bash
/home/home/SWServer/SWS &
I have no idea if this is correct as I am a linux-noob, but running the script from gui and terminal seems to run the server no problem.
- Putting the above .sh file into /etc/xbmc/live.d/
- Putting the .desktop file provided by the developer into ~/.config/autostart/
- Putting the above code (only the second line) into /etc/rc.local
- Downloading the Advanced Launcher addon and using that to execute. This does bring up the program, but this doesn't help as it brings the server to the foreground and won't let me back into xbmc unless I close the server.

None of the above works Sad...

Please help!~ Thank you.
Reply
#2
I had this same issue, I wanted to start OpenBox in the background; in order to launch emulators correctly.

My solution involved the following steps:-

1) Install base OS, then OB, XBMC, and Slim display manager
2) Configure Slim to autologin to OB
3) Use autostart directory to launch XBMC [you could then launch Soundwire here too]
4) Polish the XBMC install, following the wiki

It worked, and near seamlessly; you could see a blank OB screen for a milli second. My only real criticism doing this was that if XBMC died, it would not respawn.

Not the most elegant solution, but was all I could find.
HTPC RPI3 Kodi 17 (Krypton) v8.0.1 MR
Storage BPI 1x 500GB SSD UPnP server
Display Sony Bravia 32"
Reply
#3
Thank you for the reply.

What is Slim display manager? Do you mean Slim Login Manager?

Also, what do you mean by "if XBMC died"? Does XBMC "dying" (I am guessing force-closing due to error?) happen often? Does this not happen in XBMCbuntu?
Reply
#4
I have no experience with that program but putting it in /etc/rc.local should work. Note by default anything from /etc/rc.local is ran as root which may miss and configuration files. so you could try forcing it to run as your user.
Try this command *change xbmc if you have a different username

su xbmc -c /home/home/SWServer/SWS &
Reply
#5
Yeah, the Slim Login Manager.

Hmmm ... it would would lock now and again, but I was tinkering a lot at the time. I'm using OE at the moment, as it has the built in emulator support, and that's very stable but doesn't offer a 'boot an app in the background' that you're after. Concisely, no I don't think XBMCbuntu crashes often.
HTPC RPI3 Kodi 17 (Krypton) v8.0.1 MR
Storage BPI 1x 500GB SSD UPnP server
Display Sony Bravia 32"
Reply
#6
You got me interested in this soundwire thing, but I could not find where to download the server from. georgielabs.net appears to be a spammer signup, it is not in ubuntu repos that I can see, so I cannot try it out.

However, is the server a commandline program? If so the correct thing to do is start it as a service via an ubuntu initscript, or whatever they call them these days.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#7
try googling this then it will have some media fire links
cache:georgielabs.net
Reply
#8
@shadow, great work!
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
(2014-01-04, 03:33)nickr Wrote: You got me interested in this soundwire thing, but I could not find where to download the server from. georgielabs.net appears to be a spammer signup, it is not in ubuntu repos that I can see, so I cannot try it out.

However, is the server a commandline program? If so the correct thing to do is start it as a service via an ubuntu initscript, or whatever they call them these days.

georgielabs.net is indeed the place to look for the program. The thing I love most about this program is that the developer is very good at replying and taking in suggestions from users.
I am unsure if it is a commandline program, but it does have an option of GUI or no GUI.
Reply
#10
Well frankly from the look of the documentation, you need pulseaudio to run it, and there is no way I am screwing with my XBMC systems to do that.

Also closed source, which I will use sometimes, but it adds to the thumbs down count.

But as it seems to be a gui program, you won't easily run it in an XBMC session on XBMCbuntu because there is no window manager on the XBMC session, X starts and then runs XBMC, that's it.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#11
yeahh~ It works Smile When I was logging off of XBMC to login as XBMCbuntu, I saw a glimpse of what it looked like: SWS: Could not start x server or something to that effect.
I remembered that the developer mentioned something to that effect in the install.txt, so I went back to it and it said to disable gui with -nogui flag.

just changed the /etc/xbmc/live.d/ .sh file to:

#!/bin/bash
/home/home/SWServer/SWS -nogui&

and it worked! Smile

---
wait... The server does run and the client does connect, but no sound Sad... I can't get any sound from XBMC nor soundwire.

Ps. Does anyone know why the xbmc starts stuttering when I press alt+tab (only in the xbmc account)? It continuously stutters until I restart or re-log in.

(2014-01-04, 05:23)nickr Wrote: Well frankly from the look of the documentation, you need pulseaudio to run it, and there is no way I am screwing with my XBMC systems to do that.

Also closed source, which I will use sometimes, but it adds to the thumbs down count.

But as it seems to be a gui program, you won't easily run it in an XBMC session on XBMCbuntu because there is no window manager on the XBMC session, X starts and then runs XBMC, that's it.

Yes, whatever pulseaudio is, I installed it Smile Is this a bad thing?
Reply
#12
(2014-01-04, 01:55)shadow Wrote: I have no experience with that program but putting it in /etc/rc.local should work. Note by default anything from /etc/rc.local is ran as root which may miss and configuration files. so you could try forcing it to run as your user.
Try this command *change xbmc if you have a different username

su xbmc -c /home/home/SWServer/SWS &

If I do that, it says no password entry for xbmc. How should I enter the password?

thank you Smile
Reply
#13
You should not need a password since stuff is ran as root and root can change to any user without a password.

But as nickr pointed out your software needs pulseaudio which you should use on up to date XBMC installs. It's another sound system which XBMC doesn't use anymore.
Reply

Logout Mark Read Team Forum Stats Members Help
Auto start another program in the background0