Showing posts with label bootup. Show all posts
Showing posts with label bootup. Show all posts

Friday, 28 December 2012

Raspi python script on startup


Attempting to get a Python script to run on bootup


Door Bell
Raspberry Pi door bell, with X-Mini as amp

I used the following code to get doorbell.py to run on boot up.


sudo bash
sudo nano /etc/init.d/doorboot

### BEGIN INIT INFO
# Provides: doorboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start door bell python script at boot time
# Description: Start doorbell at boot time.
### END INIT INFO
#! /bin/sh
# /etc/init.d/doorboot
case "$1" in
 start)
   echo "Starting DoorBell"
   python /home/pi/doorbell.py &
   ;;
 stop)
   echo "Stopping DoorBell"
   python -kill :0
   ;;
 *)
   echo "Usage: /etc/init.d/doorboot {start|stop}"
   exit 1
   ;;
esac
exit 0

chmod 755 /etc/init.d/doorboot
update-rc.d doorboot defaults

It doesn't appear to work, but this does start the app
sudo /etc/init.d/doorboot start

Anybody got any ideas?
and what is a .logon file and where would I find it?