Thursday, 5 September 2013

Reboot dad

sudo systemctl reboot -i

Monday, 19 August 2013

Subsonic on openelec

mkdir java
cd java
wget
tar xvzf
ln -s jre1.7.0_21 jre (* make sure this is the correct folder name)
(*make sure java unpacks properly)

cd ~
mkdir subsonic
cd subsonic
mkdir data
mkdir app
cd app
wget
tar xvzf

cd ~/subsonic
nano startsubsonic.sh

#!/bin/sh
export JAVA_HOME=/storage/java/jre; ~/subsonic/app/subsonic.sh --home=/storage/subsonic/data \--pidfile=/var/run/subsonic.pid

(*make sure that this is all on the same line ? may have to edit from main file)

chmod +x startsubsonic.sh

check with ./startsubsonic.sh



cd ~/subsonic/data/transcode/
ln -s /usr/bin/ffmpeg ffmpeg

nano ~/.config/autostart.sh

# cat ~/.config/autostart.sh 
#!/bin/sh

# Subsonic
(
   # sleep 10 sec to be ensure network is started
   
   /storage/subsonic/startsubsonic.sh
)&


chmod +x ~/.config/autostart.sh

nano ~/subsonic/app/subsonic.sh

change max memory to ?256 and change home file





Monday, 29 July 2013

Share Ethernet Raspberry Pi

1. Set up interfaces
Your interfaces file could look something like this (we have prepared the eth0 with a static IP of 10.0.0.1 – this is your gateway for all clients).
# sudo vim /etc/network/interfaces
auto lo

iface lo inet loopback

# ETH0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0

# WLAN0 
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
address 192.168.0.160
netmask 255.255.255.0
gateway 192.168.0.1
wpa-essid 
wpa-psk 
2. Install your DHCP server
# sudo apt-get install dnsmasq
# sudo vim /etc/dnsmasq.conf
interface=eth0
dhcp-range=10.0.0.2,10.0.0.9,255.255.255.0,24h
This will make dnsmasq listen to only eth0. It also sets the available IP range to 10.0.0.2 – 10.0.0.9, and the subnet mask to 255.255.255.0. Lease time will be set to 24 hours.

3. Enable packet forwarding in sysctl
sudo vim /etc/sysctl.conf
Uncomment this line:
net.ipv4.ip_forward=1
“Reload” the sysctl with
sysctl -p
5. Create a script that runs everytime the ‘Pi comes online
# sudo vim /etc/network/if-up.d/router.sh
Add this (make sure to change INET_ADDRESS to whatever you set for your wlan0 address)
#!/bin/sh
IPT=/sbin/iptables
LOCAL_IFACE=eth0
INET_IFACE=wlan0
INET_ADDRESS=192.168.1.98

# Flush the tables
$IPT -F INPUT
$IPT -F OUTPUT
$IPT -F FORWARD

$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT

# Allow forwarding packets:
$IPT -A FORWARD -p ALL -i $LOCAL_IFACE -j ACCEPT
$IPT -A FORWARD -i $INET_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT

# Packet masquerading
$IPT -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_ADDRESS
Make it executable
# chmod +x /etc/network/if-up.d/router.sh
Apply rules and export a restorable firewall configuration script
source /etc/network/if-up.d/router.sh
iptables-save > /home/pi/router.fw
Make it start on system boot
sudo vim /etc/rc.local
Add this right above the line with “exit 0″
/sbin/iptables-restore < /home/pi/router.fw
When the script has been run it should forward packets between the LAN and Wifi interfaces.