Thursday 29 August 2013

Quick Tip: Change DNS on Raspberry pi

How to change the DNS server on your raspberry pi

If you are using Debian on Raspberry Pi, then you need to edit /etc/resolv.conf
sudo nano /etc/resolv.conf
then add the server IP of the openDNS
nameserver  208.67.222.222
nameserver 208.67.220.220

Or for Google DNS

nameserver  8.8.8.8
nameserver 8.8.4.4

Wednesday 21 August 2013

Send IP info on boot up.

Send a SMS with your internal and External IP for your Raspberry PI

First Grab a Text Local account from 

CODE: SELECT ALL
<?php
//  Pi - SMS - What is my IP bro?!
//  By Robert Wiggins
//  txt3rob@gmail.com
// Paypal Donate and let me get a Raspi-Cam!

// get the local hosts ip address
$ip = str_replace("\n","",shell_exec("ifconfig eth0 | grep 'inet addr' | awk -F':' {'print $2'} | awk -F' ' {'print $1'}"));


// External IP
$externalContent = file_get_contents('http://www.icanhazip.com/');


// Configuration variables
$info = "1";
$test = "0";

// Data for text message
$uname = '';
$pword = '';
$from = "Robbies PI";
$selectednums = "44";
$message = "You Pi Info LAN:".$ip." Ext: ".$externalContent." Raspberry Pi LCD";
$message = urlencode($message);

// Prepare data for POST request
$data = "uname=".$uname."&pword=".$pword."&message=".$message
."&from=". $from."&selectednums=".$selectednums."&info=".$info."&test=".$test;

// Send the POST request with cURL
$ch = curl_init('https://www.txtlocal.com/sendsmspost.php'); //note https for SSL
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); //This is the result from Textlocal
curl_close($ch);

//echo
echo ('You Pi Info LAN: '.$ip.' Ext: '.$externalContent.' Raspberry Pi LCD');
?>


Add A New Cron Job

To create a new job to Cron we will modify the “crontab”. This is a table that contains the list of jobs that Cron will monitor and run according to it’s details. To edit it we use the command :
sudo crontab -e
Each user of the system (ie “pi”) can have its own Crontab but in this case we want to add it as an admin so we prefix our “crontab -e” command with “sudo”. You should see something that looks like this :
Crontab Example - Python at Boot
Using your cursor keys scroll to the bottom and add the following line :
@reboot php /var/www/piboot.php &
This tells Cron that every boot (or reboot or start-up) we want to run PHP with the script piboot.php. The “&” at the end of the line means the command is run in the background and it won’t stop the system booting up as before.
Your screen should look something like this :
Crontab Example - Python at Boot
To save these changes click “CTRL-X”, then “Y” and finally “Return”. You should now be back at the command prompt.
To start testing you can now reboot using :
sudo reboot
The Cron Job part was taken from - http://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/

Wednesday 14 August 2013

Monkey HTTTPD

                      How to install monkey HTTPD on the raspberry pi

sudo mkdir /var/monkey
cd /var/monkey
sudo wget http://monkey-project.com/releases/1.1/monkey-1.2.2.tar.gz
sudo tar zxfv monkey-1.2.2.tar.gz
sudo mv monkey-1.2.2 monkey
cd monkey
sudo ./configure
sudo make
sudo nano conf/monkey.conf
sudo /var/monkey/bin/monkey -D

and done :)

Amazon

Donate

Donate Towards More Raspberry PI's for Projects