Your Link Here
Happy Farming . com How to Grow Your Own Food
  • How To Automatically Update Your Temperature Graphs

    Nov 12

    Log week 2008-11-12 21:06

    Here’s a bit more explanation on how to run the temperature logging system I described earlier.
    The system automatically stores the value of its sensors every five minutes using the crontab function in Linux. crontab is a schedule of recurring things to be done in the form of commands to be run on the system. There’s different crontab’s for different users. In this particular NSLU2 system I’m running crontab commands as root user. As far as I remember it was necessary to do that to have sufficient rights on the system.
    To see what is in your crontab at the moment, run this command:

    crontab -l

    where -l is for list only. Use -e for editing your crontab:

    crontab -e

    This will start a default editor, in my case ‘nano’, so that you can make changes to your list.

    crontab -l on this system gives this output:

    # m h  dom mon dow   command
    */5 * * * * /home/thomas/happyfarming/update_temp_2.sh &> /dev/null
    */5 * * * * /home/thomas/happyfarming/upload_temps.sh

    m: Minute. “/5″ means every five minutes.
    h: Hour
    command: Command to be executed. I run the update_temp_2.sh script every five minutes. “&> /dev/null” takes the output from this command and discards it, so that I don’t get a mail every five minutes.
    * means at every value, i.e. minute is 1 through 60 or hour is 1 through 24 etc.

    The other command or script I run is upload_temps.sh. This will upload the graphs to this website, making them available in posts.

    This is what my upload_temps.sh script looks like:

    #!/bin/bash
    sleep 30
    lftp -u USER,PASSWORD SERVER <<EOF
    cd /images/
    lcd /home/thomas/happyfarming/
    put log_h.png
    put log_d.png
    put log_w.png
    put log_m.png
    put log_y.png
    quit 0
    EOF

    using FTP to upload the files.

Sponsors


Your Ad Here