Sometimes it can be useful to run a python script at boot time.
This can be done writing an init script and using start-stop-daemon command to launch your script as daemon in backgound.
Moreover start-stop-daemon allow you to perform serveral operation like start, stop and restart of your script.

The following example was implemented on Raspbian 8 (jessy).

Assuming that your python script is under /home/me/mypython-script.py you need first to create an init script mypython under /etc/init.d as below:

#! /bin/sh
### BEGIN INIT INFO
# Provides: Python script
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Python script at boot time
# Description: Start Python script at boot tim
#
### END INIT INFO

DAEMON=/home/me/mypython-script.py
NAME=mypython-script
PIDFILE=/var/run/$NAME.pid

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

case "$1" in
 start)
   log_daemon_msg "Starting system $DAEMON_NAME daemon"
   start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --exec $DAEMON --startas $DAEMON
   log_end_msg $?
   ;;
 stop)
   echo -n "Stopping daemon: "$NAME
   start-stop-daemon --stop --oknodo --retry 30 --pidfile $PIDFILE
   ;;
 restart)
   start-stop-daemon --stop --oknodo --retry 30 --pidfile $PIDFILE
   start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON
   ;;
 *)
   echo "Usage: python-script {start|stop|restart}" >&2
   exit 3
   ;;
esac
exit 0

The “Default-Start” field specifies the run levels in which the script will be run with the “start” argument. “Default-Stop” does the reverse. For example, when the machines shuts down and enters run level 1, the script will be run with the “stop” argument.

Make the script executable:

sudo chmod a+x mypython

At the end run this command to register the script as an init script:

sudo update-rc.d tomcat defaults

After reboot you can check if the script running:

ps -ef | grep mypython

ciao