In linux, the /etc/init.d folder is used to start and stop daemons. You've got to start it, but you have to add to the script some way to stop your program (normally with a kill signal):
Code:
#! /bin/sh
# /etc/init.d/scriptName
#
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script scriptName "
/etc/SensorToMySQL // invocation of your script
;;
stop)
echo "Stopping script scriptName"
killall SensorToMySQL // send a kill signal to the program
;;
*)
echo "Usage: /etc/init.d/scriptName {start|stop}"
exit 1
;;
esac
exit 0