Skip to content

Instantly share code, notes, and snippets.

@goofyahead
Created May 21, 2015 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofyahead/e992010d5824c0832b7b to your computer and use it in GitHub Desktop.
Save goofyahead/e992010d5824c0832b7b to your computer and use it in GitHub Desktop.
I found a solution for the OSMC start/stop issue using openvt & nohup. Thanks to mkobit for the OSMC/RetroPie scripts (https://github.com/mcobit/retropie-osmc).
First we need to install kdb & libopus-dev:
apt-get update
apt-get install kbd
apt-get install libopus-dev
Code of my scripts:
/home/limelight/limelight.sh:
#!/bin/sh
sudo openvt -c 7 -s -f clear
sudo openvt -c 7 -s -f echo "Running limelight from KODI"
# Start watchdog
sudo su osmc -c "sh /home/limelight/limelight_watchdog.sh &" &
# Start stream
sudo su osmc -c "nohup openvt -c 7 -s -f sh /home/limelight/stream.sh >/dev/null 2>&1 &" &
sudo openvt -c 7 -s -f clear
sleep 2
# Stop mediacenter
sudo su -c "systemctl stop mediacenter &" &
exit
/home/limelight/stream.sh:
sudo /sbin/modprobe snd-bcm2835
sudo java -jar /home/limelight/limelight.jar pair 192.168.x.x
sudo java -jar /home/limelight/limelight.jar stream 192.168.x.x -1080 -30fps
/home/limelight/limelight-watchdog.sh:
#!/bin/bash
sleep 60
while [ true ]; do
VAR1="$(pgrep java)"
if [ ! "$VAR1" ]; then
sudo openvt -c 7 -s -f clear
sudo openvt -c 7 -s -f echo "Limelight quit... Starting KODI."
sleep 1
sudo openvt -c 7 -f clear
sudo su -c "sudo systemctl restart mediacenter &" &
sleep 1
exit
else
sleep 2
fi
done
In OSMC just set a shortcut to "System.Exec(/home/limelight/limelight.sh)".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment