2012-11-24

Install OWFS on Fedora

I want to log the outdoor temperature in a database. When I heard about 1wire I thought this would be interesting to test.

On temperatur.nu I found the guide OWFS Howto very useful. There is one thing to update for me:
  • I had to start it with the following line:
    /opt/owfs/bin/owfs --allow_other --passive=/dev/ttyS0 /mnt/1wire 
 I also created a start script /etc/rc.d/init.d/start1wire to start it permanently. It is not very beautiful but it seems to work for me.
#!/bin/bash
#
# OWFS
#
# Author:       Niklas Lanzen
# chkconfig:    1000 50 50
# description:  1 wire
#

RETVAL=0;

prog="OWFS (One Wire File System)"
exec="/opt/owfs/bin/owfs --allow_other --passive=/dev/ttyS0  /mnt/1wire"
#lockfile=""

# Source function library.
. /etc/init.d/functions

start() {

        echo -n $"Starting $prog: "
        $exec
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
}

stop() {
        [ $UID -eq 0 ] || exit 4
        echo -n $"Stopping $prog: "
        success
        echo
}

restart() {
        stop
        sleep 1
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        RETVAL=2
        [ "$1" = 'usage' ] && RETVAL=0
esac

No comments:

Post a Comment