open All Channels
seplocked Linux
blankseplocked Posalarm Prototype I
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

Ravow
Minmatar
Cosmic Encounter
Mayhem.
Posted - 2010.09.24 07:45:00 - [1]
 

Hi,

I just finished a POS alarm sh script!
It can be used with twitter to SMS all your corp if one of your POS is under attack or need fuel. Your free to improve it. If you want to distribute your improvement, please send a copy to admin at@at korinar.org.

Please tell me any recommendation

Here the link to the file (copy-past it in a .sh file....)
POSALARM PROTOTYPE I

Here a weirdos version modified by the forum
===================CUT HERE===================

#!/bin/sh

#############################################################
# POS Alarm v0.1 (C)Ravow, pirate of New Eden #
# This work is being published under Liberty License (2010) #
#############################################################

# Configuration here!
controldir="/tmp/posalarm" # Where I put files :)
toweralertcommand="/usr/bin/a command" # What I need to run if one of your tower is attacked
towerfuelcommand="/usr/bin/a command" # What I need to run if one of your tower need food

###################################################################################################################################
# PLEASE KEEP THIS FILE SAFE WITHOUT ACCESS #
# API KEY #
# 6 full api key must be configured here. The char linked with these apikey must be corporation Director on the same corporation. #
# The script must be executed with a cronjob each 5 minutes #
# The api caching for the used function is 30 minutes (6 x 5 = 30). #
###################################################################################################################################

userid[1]=""
charid[1]=""
apikey[1]=""
userid[2]=""
charid[2]=""
apikey[2]=""
userid[3]=""
charid[3]=""
apikey[3]=""
userid[4]=""
charid[4]=""
apikey[4]=""
userid[5]=""
charid[5]=""
apikey[5]=""
userid[6]=""
charid[6]=""
apikey[6]=""

# We need to check and calculate wich api to use and who is the next.

if [ ! -d $controldir ]; then
mkdir $controldir
fi

if [ ! -e $controldir/position ]; then
echo "2" > $controldir/position
position=1
else
position=`cat $controldir/position`
newposition=`expr $position + 1`
if [ $newposition -eq "7" ]; then
newposition=1
fi
echo $newposition > $controldir/position
fi

# On evite le spam.......

if [ -e $controldir/alarm ]; then
alarm=`cat $controldir/alarm`
if [ $alarm -eq $position ]; then
rm $controldir/alarm
else
exit
fi
fi

# Download xml file to analyse with the api
fileget="http://api.eve-online.com/char/Notifications.xml.aspx?userID=${userid[$position]}&characterID=${charid[$position]}&apiKey=${apikey[$position]}"
wget $fileget -O $controldir/test.cx

check75=`cat $controldir/test.cx | grep "\"75\"" | wc -l`
check76=`cat $controldir/test.cx | grep "\"76\"" | wc -l`
rm $controldir/test.cx
if [ $check75 -ne "0" ]; then
echo $position > $controldir/alarm
# echo "ALARM!!!!!"
# Preparing twitter request
run1=`$toweralertcommand`
fi

if [ $check76 -ne "0" ]; then
echo $position > $controldir/alarm
# echo "FUEL!!!!!"
# Preparing twitter request
run1=`$towerfuelcommand`
fi


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only