Register
It is currently Wed Nov 26, 2014 6:38 am

FaCC - (Fa)d (C)lient (C)ontroller


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Fri Jun 17, 2005 10:48 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
Starting a new project ...... for our FAD team at usalug.org ......
This is just the very start of the code.... i'm too tired to work on it anymore tonight :lol:

Code:
#!/bin/bash
#
########################################################
# FaCC - (Fa)d (C)lient (C)ontroller                   #
#              On the web at www.bashscripts.org       #
#####################################################################################
#                                                                                   #
#    FILE: facc                                                                     #
# VERSION: See variable (facc_version) below.                                       #
#    DATE: See variable (revision_date) below.                                      #
#                                                                                   #
#  AUTHOR: Dave Crouse <dave NOSPAMat usalug.org>                                   #
#      c/o USA Linux Users Group                                                    #
#          PO Box 3210                                                              #
#          Des Moines, IA 50316-0210                                                #
#          United States                                                            #
#                                                                                   #
#                                                                                   #
# Copyright (C) 2004-2005 Dave Crouse <dave NOSPAMat usalug.org>                    #
# All rights reserved.                                                              #
#                                                                                   #
# This program is free software; you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by              #
# the Free Software Foundation; either version 2 of the License, or                 #
# (at your option) any later version.                                               #
#                                                                                   # 
# This program is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of                    #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                     #
# GNU General Public License for more details.                                      #
#                                                                                   #
# You should have received a copy of the GNU General Public License                 #
# along with this program; if not, write to the Free Software                       #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         #
#                                                                                   #
#####################################################################################
#
######################
# Start of Variables #
###########################################
                                         ##
                                         ##
                                         ##
facc_version="0.0.1"                     ##
revision_date="Modified June 18, 2005"   ##
author="Created by: Dave Crouse"         ##
                                         ##
                                         ##
                                         ##
###########################################
# End of Variables   #
######################

######################
# Start of Functions #
######################
#
#

############### START MENU FUNCTIONS

Main_Menu ()
{
mainmenu="\t1)\tCheck for Previously Installed Fad Client\n\t2)\tInstall NEW Fad Client\n\t3)\tKill running servers\n\t4)\tStart server\n\t5)\tList job que and progress\n\t6)\tList FAD configuration\n\t0)\tExit"
headerfile
echo "        ---------- Main Menu -----------";
echo "";
echo -e "$mainmenu"
echo "";
read -p "Please choose one of the options above : " option

while true
do
   case $option in
      1)   xxxxxxxx;
         ;;
      2)   xxxxxxxx;
         ;;
      3)   xxxxxxxx;
         ;;
      4)   xxxxxxxx;
         ;;
      5)   xxxxxxxx;
         ;;
      6)   xxxxxxxx;
         ;;   
      0)   option="";
         exit;
         ;;
      *)   echo "That choice was invalid!!";
         ;;
   esac
   headerfile
   echo "        ---------- Main Menu -----------";
   echo "";
   echo -e "$mainmenu"
   echo "";   
   read -p "Please choose one of the options above : " option
done

}


############### END MENU FUNCTIONS


############### START PROGRAM FUNCTIONS


############### END PROGRAM FUNCTIONS

############### Start Generic Header Function

headerfile ()
{
clear
echo " 
    _________   ____________
   / ____/   | / ____/ ____/
  / /_  / /| |/ /   / /
/ __/ / ___ / /___/ /___
/_/   /_/  |_\____/\____/

(Fa)d (C)lient (C)ontroller
                     Version $facc_version  ";
echo "----------------------------------------";
echo "";
}

############### End Generic Header Function


#
#
####################
# End of Functions #
####################

###########################
# Program run starts here #
###########################

Main_Menu
exit


Top
 Profile WWW  
 PostPosted: Tue Aug 23, 2005 6:53 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
Working towards something like this.......

Install FAD
Install FAD
Create entry in the .bashrc file for facc
Create automatic startup entry for XXXXX distro

Configure FAD
View current configuration
Change current configuration

Current Status
View current processes

Manual Intervention
Start fad server
Stop fad server

Download jobs
Upload jobs


This is what i have so far :
http://www.bashscripts.org/downloads/Sc ... cc/facc.sh

Code:
#!/bin/bash
#
########################################################
# FaCC - (Fa)d (C)lient (C)ontroller                   #
#              On the web at www.bashscripts.org       #
#####################################################################################
#                                                                                   #
#    FILE: facc                                                                     #
# VERSION: See variable (facc_version) below.                                       #
#    DATE: See variable (revision_date) below.                                      #
#                                                                                   #
#  AUTHOR: Dave Crouse <dave NOSPAMat usalug.org>                                   #
#      c/o USA Linux Users Group                                                    #
#          PO Box 3210                                                              #
#          Des Moines, IA 50316-0210                                                #
#          United States                                                            #
#                                                                                   #
#                                                                                   #
# Copyright (C) 2004-2005 Dave Crouse <dave NOSPAMat usalug.org>                    #
# All rights reserved.                                                              #
#                                                                                   #
# This program is free software; you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by              #
# the Free Software Foundation; either version 2 of the License, or                 #
# (at your option) any later version.                                               #
#                                                                                   #
# This program is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of                    #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                     #
# GNU General Public License for more details.                                      #
#                                                                                   #
# You should have received a copy of the GNU General Public License                 #
# along with this program; if not, write to the Free Software                       #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         #
#                                                                                   #
#####################################################################################
#
######################
# Start of Variables #
#########################################################
                                                       ##
                                                       ##
                                                       ##
facc_version="0.0.6"                                   ##
revision_date="Modified August 23, 2005"               ##
author="Created by: Dave Crouse"                       ##
                                                       ##
                                                       ##
faddirectory="/usr/local/think"                        ##
fadprogramver=fadv125g.tgz                             ##
downloadurl="http://www.find-a-drug.org/fadv125g.tgz"  ##
tnumber="2104"                                         ##
                                                       ##
#########################################################
# End of Variables   #
######################




######################
# Start of Functions #
######################
#
#

############### START MENU FUNCTIONS

Main_Menu ()
{
mainmenu="\t1)\tInstall NEW Fad Client\n\t2)\tList current FAD configuration\n\t3)\tKill running servers\n\t4)\tStart server\n\t5)\tList job que and progress\n\t0)\tExit"
headerfile
echo "        ---------- Main Menu -----------";
echo "";
echo -e "$mainmenu"
echo "";
read -p "Please choose one of the options above : " option

while true
do
   case $option in
      1)   installfadscript;
         ;;
      2)   cd /usr/local/think/; ./fadsetup -list; echo "" ; read -p "Hit any key to continue" blah
         ;;
      3)   killall server ; echo "Stopped Think Server" ; read -p "Hit any key to continue" blah
         ;;
      4)   cd /usr/local/think; ./loader; echo "Restarted Think Server" ; read -p "Hit any key to continue" blah
         ;;
      5)   cd /usr/local/think; ./server -list; echo "" ; read -p "Hit any key to continue" blah
         ;;
      0)   option="";
         exit;
         ;;
      *)   echo "That choice was invalid!!";
         ;;
   esac
   headerfile
   echo "        ---------- Main Menu -----------";
   echo "";
   echo -e "$mainmenu"
   echo "";   
   read -p "Please choose one of the options above : " option
done

}

############### END MENU FUNCTIONS



checkforroot ()
{
clear
echo "USA Linux Users Group Fad Client Controller Script"
echo ""
echo "This script needs to be run as root."
echo "Now checking for root permissions"
sleep 1
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo ""
echo "**************** ERROR !! **************"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Program HALTED."
sleep 1
echo ""
echo "This script is located in the following directory"
pwd
echo ""
echo "**************** ERROR !! **************"
exit
fi
echo "You are running as root.. good .. moving along now ;) "
sleep 2
}

headerfile ()
{
clear
echo "
     USA Linux Users Group's
    _________   ____________
   / ____/   | / ____/ ____/
  / /_  / /| |/ /   / /
/ __/ / ___ / /___/ /___
/_/   /_/  |_\____/\____/

(Fa)d (C)lient (C)ontroller
                     Version $facc_version  ";
echo "----------------------------------------";
echo "";
}




#
#
####################
# End of Functions #
####################
















installfadscript ()
{
#########################
# Created by the        #
# USA Linux Users Group #
# http://www.usalug.org #
#########################
#
######################################
# Find a Drug Linux Client installer #
# Developed at BashScripts.org       #   
# By Crouse                          #
######################################
#
########################
# Program Version .0.5 #
########################
#
######################
# Start of Variables #
######################




######################
# Start of Functions #
######################




fileextraction ()
{
# Download and Extract FAD
sleep 1
echo "Starting download of file now"
wget $downloadurl
echo "."
echo "File successfully downloaded"
sleep 1
echo "Now Creating the FAD Directory"
mkdir $faddirectory
echo "New Directory Created"
sleep 1
echo "Now moving dowloaded file to the new directory"
mv $fadprogramver $faddirectory
echo "File Moved"
sleep 1
echo "Starting extraction of the FAD program"
sleep 1
cd $faddirectory
tar zxvf $fadprogramver
echo "Files Extracted"
}


fadsetup ()
{
# Prompt for FAD setup variables
sleep 1
echo "Beginning Client Registration"
echo "You will be prompted for your username, email address, and team number"
sleep 1
# Prompt for username email and team number
# Suggested by jbsnake
read -p "Please enter your username: " uname
read -p "Please enter your email address: " eaddress
echo "y" | ./fadsetup -nickname "$uname" -team "$tnumber" -email "$eaddress" -connect "When online" -country "United
States"
# Note - should do some error checking to make sure that the person entered the information correctly here.
echo "Yes - This script auto-accepted the user agreement."
sleep 2
echo "Registration for TEAM $tnumber Complete."
sleep 1
echo "Now removing the installation file"
rm $fadprogramver
echo "File $fadprogramver removed"
sleep 1
echo "."
echo "."
echo "Congratulations $uname you have successfully installed the Linux Find-A-Drug Client"
echo "Installation Complete"
sleep 2
}


installnotes ()
{
# Notes for after installation has completed successfully
echo "."
echo "."
echo "----------NOTES---------"
echo "You may change the username by typing ./fadsetup -nickname YOURUSERNAMEHERE"
echo "You may check the status of your FAD client by typing ./server -list"
echo "If you need to restart your client --as ROOT--  cd $faddirectory ./loader"
echo "The script is being worked on at USALUG's bashscripts.org website"
echo "For the most up to date version visit: http://bashscripts.org/viewtopic.php?id=42"
echo "Download current versions of this script at: http://www.bashscripts.org/downloads/Scripts/crouse/"
echo "-------------------------"
echo "."
echo "."
echo "FAD Client Controller $facc_version was created by Crouse for the USA Linux Users Group."
echo "Please visit us at http://www.usalug.org and also at http://www.bashscripts.org"
echo "."
sleep 3
}


listjobs ()
{
# Attempt to list the running jobs
echo "In a few seconds we will attempt to list your running client jobs"
echo "You should have a job running or a job in que. If not wait a few minutes and type ./server -list"
sleep 3
echo "Trying to list current jobs in process.... one moment please.. this will take 2 minutes.. please wait..."
echo "or you can hit CTL-C to end"
sleep 120
./server -list
sleep 3
echo "That's all Folks !!! :)  "
}

####################
# End of Functions #
####################


###########################
# Program run starts here #
###########################
clear
# Program is broken down into segments(functions)

fileextraction
fadsetup
installnotes
listjobs

# end the program
}













###########################
# Program run starts here #
###########################
checkforroot
Main_Menu
exit



Top
 Profile WWW  
 PostPosted: Thu Aug 25, 2005 2:38 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
NEWER VERSION !!!!!!

http://www.bashscripts.org/downloads/Sc ... c.0.0.7.sh

Code:

     USA Linux Users Group's
    _________   ____________
   / ____/   | / ____/ ____/
  / /_  / /| |/ /   / /
/ __/ / ___ / /___/ /___
/_/   /_/  |_\____/\____/

(Fa)d (C)lient (C)ontroller
                     Version 0.0.7
----------------------------------------

        ---------- Main Menu -----------

        1)      Installation Menu
        2)      Configuration Menu
        3)      Status Menu
        4)      Manual Control Menu
        0)      Exit

Please choose one of the options above :


Seperated some of the functions into smaller menus, and can add more stuff as I go. A bit more organized now.


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: TurnitinBot [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP