Posting a stat from a shell script using curl
You can use curl to send data to StatHat via a shell script. For example, here's a little script that gets the number of files in a directory and sends it to StatHat:
#!/bin/sh FILECOUNT=`ls /tmp | wc -l` echo Number of files: $FILECOUNT curl -d "email=your@email.com&stat=number of files&value=$FILECOUNT" http://api.stathat.com/ez
There seems to be a problem with the formatting of the code snippets. thanks.
posted 2012-09-16 11:11:41FILECOUNT=`ls /tmp | wc -l` change to FILECOUNT=`ls /tmp | wc -l | awk '{print $1}'`
posted 2013-02-16 13:23:20