#!/bin/bash ######################################################################## # # filename: irlp-tweet # # description: This file will post your link status to a Twitter account. # It REQUIRES to also set up a SUPERTWEET.COM Proxy # Account to handle a workaround for Twitters Oauth policy. # # original authors: For this file, it is Chuck, N4YCW (IRLP4124) # # Place in a directory, I used: irlp/custom # Add a call to this file in your custom on/off files. # Example $CUSTOM/irlp-tweet # # # history: # 2009-01-19 n4ycw Initial. # 2009-01-19 kc6hur added compatability with EchoIRLP and changed # message format. # # 2011-07-04 w2ymm changed url to use Suupertweet as the Oauth # Proxy to handle tweets. And i created a # Readme file for installation assistance. # ######################################################################## # # configuration section, self-explanatory USERNAME="xxxxxxxx" #Twitter user name PASSWORD="xxxxx" #Supertweet password NOT Twitter password # Change false to true if you want Echolink callsign to be displayed; # otherwise, Echolink node number will be displayed. USE_CALLSIGN=true ############################################# # # Nothing should need to be changed below to make this functional. # if [ ${#STATIONID} = "6" ] ; then CONVERTED_STATIONID="$STATIONID"0 else CONVERTED_STATIONID="$STATIONID" fi NODE_NUM=`echo $CONVERTED_STATIONID | cut -c 4-7` URL="http://api.supertweet.net/1/statuses/update.xml" # Make sure we are user repeater!!! if [ `/usr/bin/whoami` != "repeater" ] ; then echo This program must be run as user REPEATER! exit 1 fi # Make sure we have sourced the environment file if [ "$RUN_ENV" != "TRUE" ] ; then . /home/irlp/custom/environment fi # # Assemble the Node Status # if [ ! -f $LOCAL/enable ] ; then # Missing $LOCAL/enable = OFFLINE NODE_STATUS="OFFLINE" elif [ -f $LOCAL/active ] ; then # $LOCAL/active = CONNected/BUSY if [ -s $LOCAL/active ] ; then # Not Empty $LOCAL/active = CONNected if [ -s $LOCAL/echo_active ] ; then # See if connected to EchoLink if $USE_CALLSIGN ; then NODE_STATUS="CONNECTED to EchoLink `cat $LOCAL/echo_call | tr [:lower:] [:upper:]`" else NODE_STATUS="CONNECTED to EchoLink `cat $LOCAL/echo_active`" fi else # Must be an IRLP connection # Uncomment the next line to strip the STN or REF from the connected node number # NODE_STATUS="CONNECTED to IRLP `cat $LOCAL/active | cut -c 4-7`" # Comment the next line if the above line is uncommented NODE_STATUS="CONNECTED to IRLP `cat $LOCAL/active | tr [:lower:] [:upper:]`" fi else # Empty $LOCAL/active = BUSY NODE_STATUS="BUSY" fi else # Missing $LOCAL/active = IDLE NODE_STATUS="IDLE" fi result=`curl -u $USERNAME:$PASSWORD -d status="IRLP $NODE_NUM: $NODE_STATUS" $URL` exit