From 499a2b8239918b1be9f225361c791fe42a952374 Mon Sep 17 00:00:00 2001 From: John W Kerns Date: Fri, 1 Sep 2017 22:08:29 -0700 Subject: [PATCH] Updated headers --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++-- checkmyip.py | 15 ++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec91861..cea709c 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,86 @@ yum install openssl-devel -y pip install python-gssapi ``` - - +Install Binary +``` +cp checkmyip.py /bin/checkmyip +chmod 777 /bin/checkmyip + +mkdir -p /etc/checkmyip/ +``` + +Create Service (`vi /etc/init.d/checkmyip`) +``` +#!/bin/bash +# radiuid daemon +# chkconfig: 345 20 80 +# description: RADIUS to Palo-Alto User-ID Engine +# processname: radiuid + +DAEMON_PATH="/bin/" + +DAEMON=radiuid +DAEMONOPTS="run" + +NAME=RadiUID +DESC="RADIUS to Palo-Alto User-ID Engine" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +case "$1" in +start) + printf "%-50s" "Starting $NAME..." + cd $DAEMON_PATH + PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!` + #echo "Saving PID" $PID " to " $PIDFILE + if [ -z $PID ]; then + printf "%s +" "Fail" + else + echo $PID > $PIDFILE + printf "%s +" "Ok" + fi +;; +status) + if [ -f $PIDFILE ]; then + PID=`cat $PIDFILE` + if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then + printf "%s +" "Process dead but pidfile exists" + else + echo "$DAEMON (pid $PID) is running..." + fi + else + printf "%s +" "$DAEMON is stopped" + fi +;; +stop) + printf "%-50s" "Stopping $NAME" + PID=`cat $PIDFILE` + cd $DAEMON_PATH + if [ -f $PIDFILE ]; then + kill -HUP $PID + printf "%s +" "Ok" + rm -f $PIDFILE + else + printf "%s +" "pidfile not found" + fi +;; + +restart) + $0 stop + $0 start +;; + +*) + echo "Usage: $0 {status|start|stop|restart}" + exit 1 +esac +``` diff --git a/checkmyip.py b/checkmyip.py index 4bd5001..1cf25ba 100644 --- a/checkmyip.py +++ b/checkmyip.py @@ -1,3 +1,18 @@ +#!/usr/bin/python + + +##### CheckMyIP Server ##### +##### Written by John W Kerns ##### +##### http://blog.packetsar.com ##### +##### https://github.com/packetsar/checkmyip ##### + + +##### Inform version here ##### +version = "v1.0.0" + + + + import os import sys import time