Last active
August 29, 2015 14:01
-
-
Save jhenkens/b7ac850780fc249df27b to your computer and use it in GitHub Desktop.
OpenElec Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# OpenElec Power Script to restart XBMC | |
# I didn't want to bind any special buttons to reboot xbmc, and I already had a button to sleep cycle the box. | |
# I wrote this script to kill xbmc within OpenElec if you sleep and then wake within 60 secodns | |
# Put it in /storage/.config/sleep.d/01-autoreboot | |
# Or whatever you want within sleep.d, autoreboot is a terrible name | |
LOCDIR=/storage/.config/.autoreboot | |
mkdir -p "$LOCDIR" | |
LOC="$LOCDIR"/timestamp | |
TIME=`date +%s` | |
case "$1" in | |
post) | |
if [ -f "$LOC" ] ; then | |
OLDTIME=`cat "$LOC"` | |
DIFF=$((TIME-OLDTIME)) | |
DIFF=${DIFF#-} | |
if [ $DIFF -lt "60" ]; then | |
killall -HUP xbmc.bin | |
fi | |
fi | |
;; | |
pre) | |
echo $TIME > "$LOC" | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this is my autostart script for OpenElec | |
# It mounts a Samba share 'Pictures' at 'server.lan' after making sure that the server is up (well, to the best of its abilities) | |
# This is useful for things that need to be accessed directly rather than through xbmc's file handlers. | |
# It also removes that damn sleep disabler from OpneElec 4.0.0+ for removable media | |
# I use openelec as a thin client to content stored on a server, I don't need my storage to be safe/reliable on my sd card! | |
set -x | |
rm -f /dev/.suspend_disabled | |
n=1 | |
server="server.lan" | |
shares="Pictures" | |
sambapass="test" | |
sambauser="test" | |
# can be nfs for nfs or cifs for samba or windows shares | |
type=cifs | |
until ping -w 1 -c 1 "$server" &>/dev/null ;do | |
sleep 1 | |
n=$(( n+1 )) | |
[ $n -eq 30 ] && break | |
done | |
for share in $shares ;do | |
[ -d /media/$share ] || mkdir -p /media/$share | |
if [ $type == cifs ];then | |
mount -t $type -o username=$sambauser,password=$sambapass,rw //$server/$share /media/$share | |
elif [ $type == nfs ];then | |
mount -t $type $server:/$share /media/$share | |
fi | |
done | |
ln -sf /media /storage/media |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment