Archiv nach Monaten: Oktober 2012

Automatic execute on startup :: Debian Linux (Raspberry Pi)

I’ve got a Raspberry Pi with connected camera. When the Pi boots up there should be executed a script which starts the camera software.

You must create an new file in /etc/init.d/ and then add the following content:

# /etc/init.d/startcam

# Carry out specific functions when asked to by the system
case "$1" in
    pkill webcam
    echo "stopped"
    echo "Usage: /etc/init.d/startcam {start|stop}"
    exit 1

exit 0

then make the file executeable

sudo chmod +x /etc/init.d/startcam

to test your script, you must be shure that it isn’t active

ps -ef | grep webcam

then start the script using

sudo /etc/init.d/startcam start

or just reboot your computer and check once again if your script is active.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +2 (from 2 votes)

Finding the IP of my Raspberry Pi

With ssh configured the Raspi can be attached using putty after booting.
But how do I know about the IP the raspi got from DHCP? There are several possibilities to look:
1) If there is a screen attached at console the IP can be read there.
But I operate the raspi in different networks just with LAN and power connected only.
2.) In home networks the  web interface of the router (NetGear, FritzBox or whatever) can tell you the IP.
3) For Android users there is a very nice App called ‚fing‘. This app reports all devices on the local network, and the nice thing is, that it tells also which hardware is connected and tells ‚Raspberry Pi Foundation‘ in case of the raspi. I do not know what apps to use with other mobile equipment, but look in the apps store to find the solution.
4) It can also be usefull to operate with the hostname. From a windows PC there is an easy way to be able to call the raspi by name. Samba has to be configured. To use this service it is only neccessary to install and operate samba:

sudo apt-get install samba samba-common-bin
sudo /etc/init.d/samba start

Now with putty you need not to put in the ip it is also possible to enter the hostname.

The hostname can be changed by editing

sudo vim /etc/hosts
sudo vim /etc/hostname

and chage ‚raspberrypi‘ to ‚YourDesiredHostName‘. A short name can be very usefull.
If you want to know the IP address from the hostname open a cmd-Window (Dos-shell) and type
ping raspberrypi
Ping will tell you  the IP address it is pinging to.
5) If you are logged in you can display the IP address with:

hostname -i


VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

First Start with Raspberry Pi

After unpacking starting is very easy. There is a lot information available online. Here a few tipps where to look and what to do.
A good choice is the raspberrypi homepage:
What you first need is software to run the device. What you need is the Win32Diskmanager and an image to load. I started with the Raspian „wheezy“. Download both and run the Win32Diskmanager to bring the software to the SD card. For details refer to the quick start guide for beginners linked from the download page of raspberry pi:
After that the raspi is ready for the first run. Connect a keyboard to a USB port a monitor to HDMI-port and power the device with a USB cable, After starting the config menu appears automatically.
To use the entire space of the SDcard select ‚expand_rootfs‘. A good idea is to change the password. ‚change_locale‘ and ‚change_timezone‘ should also be configured.
I prefer running the raspi through a console, so I need ssh to be enabled and I don’t need the desktop to be automatically loaded on boot. Finally update the raspi before leaving the menu.
Now the raspi should be rebooted. This will take a while because the root partition will be reconfigured.
The raspi configuration can be repeated any time with:
sudo raspi-config

The raspi is ready for the first use.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)