Skip to content

Commit 48d27ca

Browse files
committed
After 6 months of downloading data I am able to release GitHub Repository Traffic Parser #29
1 parent 707bc02 commit 48d27ca

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

github-repository-traffic/github.repository.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
2-
# github-repository-traffic/github.repository.list 3.1.1.628 2020-02-16T21:26:21.278548-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.131
3-
# Include GitHub repository traffic data in README close #29
2+
# github-repository-traffic/github.repository.list 3.2.0.711 2020-02-18T13:30:01.445134-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.4-26-g707bc02
3+
# After 6 months of downloading data I am able to release GitHub Repository Traffic Parser #29
44
# github-repository/github.repository.list 2.56.225 2019-08-01T14:19:43.745807-05:00 (CDT) https://github.com/BradleyA/Linux-admin uadmin two-rpi3b.cptx86.com 2.55
55
# github.repository.list create example file with github repository names with one on each line
66
# Change the following lines to your github repository names

github-repository-traffic/owner.repository

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
2-
# github-repository-traffic/owner.repository 3.1.1.628 2020-02-16T21:26:27.092163-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.131
3-
# Include GitHub repository traffic data in README close #29
2+
# github-repository-traffic/owner.repository 3.2.0.711 2020-02-18T13:30:16.955683-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.4-26-g707bc02
3+
# After 6 months of downloading data I am able to release GitHub Repository Traffic Parser #29
44
# github-repository-traffic/owner.repository 2.131.627 2020-02-16T20:36:47.893512-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.130-2-g145d2c7
55
# github-repository-traffic/owner.repository add YEAR DIRECTORY close #43
66
#86# github-repository-data/owner.repository

github-repository-traffic/parse.repository.data.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/bash
2-
# github-repository-traffic/parse.repository.data.sh 3.1.4.684 2020-02-18T11:36:45.247621-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.3-11-g30fc2be
3-
# github-repository-traffic/parse.repository.data.sh change clone and view table titles
4-
# github-repository-traffic/parse.repository.data.sh 3.1.3.672 2020-02-17T12:05:34.732537-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.2-32-g1b0d98d
5-
# github-repository-traffic/setup.github.repository.sh rename DATA_GITHUB_DIR to GITHUB_DATA_DIR
6-
# github-repository-traffic/parse.repository.data.sh 3.1.2.639 2020-02-17T00:17:20.026356-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.1-10-g0f9a207
7-
# github-repository-traffic/parse.repository.data.sh correct incident caused by #39 during testing
2+
# github-repository-traffic/parse.repository.data.sh 3.2.0.711 2020-02-18T13:30:17.137229-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.4-26-g707bc02
3+
# After 6 months of downloading data I am able to release GitHub Repository Traffic Parser #29
84
# github-repository-traffic/parse.repository.data.sh 3.1.1.628 2020-02-16T21:26:27.185252-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.131
95
# Include GitHub repository traffic data in README close #29
106
# github-repository-traffic/parse.repository.data.sh 2.130.624 2020-02-16T17:37:37.704997-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.129-16-g9f56c17

github-repository-traffic/setup.github.repository.sh

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
2-
# github-repository-traffic/setup.github.repository.sh 3.1.3.672 2020-02-17T12:05:34.892699-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.2-32-g1b0d98d
3-
# github-repository-traffic/setup.github.repository.sh rename DATA_GITHUB_DIR to GITHUB_DATA_DIR
2+
# github-repository-traffic/setup.github.repository.sh 3.2.0.711 2020-02-18T13:30:17.247691-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 3.1.4-26-g707bc02
3+
# After 6 months of downloading data I am able to release GitHub Repository Traffic Parser #29
44
# github-repository-traffic/setup.github.repository.sh 3.1.1.628 2020-02-16T21:26:27.280594-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.131
55
# Include GitHub repository traffic data in README close #29
66
# github-repository-traffic/setup.github.repository.sh 2.126.549 2020-02-12T12:38:21.881162-06:00 (CST) https://github.com/BradleyA/Linux-admin.git master uadmin five-rpi3b.cptx86.com 2.125-8-gf0169cc
@@ -15,8 +15,6 @@
1515
# github-repository-traffic/parse.repository.data.sh update display_help and ARCHITECTURE TREE
1616
# github-repository-traffic/setup.github.repository.sh 2.110.422 2020-01-02T14:29:22.707637-06:00 (CST) https://github.com/BradleyA/Linux-admin uadmin six-rpi3b.cptx86.com 2.109-32-gf918a75
1717
# github-repository-traffic/setup.github.repository.sh upgrade script Production standards
18-
# github-repository/setup.github.repository.sh 2.80.291 2019-08-05T10:49:54.851588-05:00 (CDT) https://github.com/BradleyA/Linux-admin uadmin two-rpi3b.cptx86.com 2.79-1-g07eb720
19-
# github-repository/setup.github.repository.sh add code for clone.heading & view.heading
2018
# github-repository/setup.github.repository.sh 2.45.209 2019-07-29T22:54:36.803070-05:00 (CDT) https://github.com/BradleyA/Linux-admin uadmin two-rpi3b.cptx86.com 2.44
2119
# github-repository/setup.github.repository.sh making this up as I go . . .
2220
##########
@@ -42,7 +40,7 @@ CYAN=$(tput setaf 6)
4240
WHITE=$(tput setaf 7)
4341

4442
### production standard 7.0 Default variable value
45-
DEFAULT_GITHUB_DATA_DIR="/usr/local/data/github/"
43+
DEFAULT_GITHUB_TRAFFIC_DIR="/usr/local/data/github/"
4644
DEFAULT_GITHUB_OWNER="BradleyA" # Required for this script to work. Either as the first argument on the command line or defined as GITHUB_OWNER environment variable or hard coded here #34
4745

4846
### Production standard 8.3.541 --usage
@@ -72,7 +70,7 @@ echo "<GITHUB_OWNER> can be the first argument on the command line or defined
7270
echo "GITHUB_OWNER environment variable."
7371
echo -e "\nData storage is required for this solution, so you need to have permission"
7472
echo "to create /usr/local/data/github for short and long term storage. To use"
75-
echo "a different directory export GITHUB_DATA_DIR environment variable."
73+
echo "a different directory export GITHUB_TRAFFIC_DIR environment variable."
7674
echo -e "\nIn the future, this printed crontab list will be appended to a crontab file."
7775
echo "The crontab command normally only manages a single crontab per user. Need a"
7876
echo "method for multiple SRE team members to manage one crontab."
@@ -108,8 +106,8 @@ echo " setting 4 and exit if any command in a pipeline erro
108106
echo " more information about the set options, see man bash." # 3.550
109107
#
110108
echo " GITHUB_OWNER Github repository account name (default ${DEFAULT_GITHUB_OWNER})" #34
111-
echo " GITHUB_DATA_DIR GitHub long term traffic solution directory"
112-
echo " (default ${DEFAULT_GITHUB_DATA_DIR})"
109+
echo " GITHUB_TRAFFIC_DIR GitHub long term traffic solution directory"
110+
echo " (default ${DEFAULT_GITHUB_TRAFFIC_DIR})"
113111

114112
echo -e "\n${BOLD}OPTIONS${NORMAL}"
115113
echo -e "Order of precedence: CLI options, environment variable, default value.\n" # 3.572
@@ -221,55 +219,55 @@ done
221219
if [[ $# -ge 1 ]] ; then GITHUB_OWNER=${1} ; elif [[ "${GITHUB_OWNER}" == "" ]] ; then GITHUB_OWNER=${DEFAULT_GITHUB_OWNER} ; fi #34
222220
if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Variable... GITHUB_OWNER >${GITHUB_OWNER}<" 1>&2 ; fi
223221
# Order of precedence: environment variable, default code
224-
if [[ "${GITHUB_DATA_DIR}" == "" ]] ; then GITHUB_DATA_DIR=${DEFAULT_GITHUB_DATA_DIR} ; fi
225-
if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Variable... GITHUB_DATA_DIR >${GITHUB_DATA_DIR}<" 1>&2 ; fi
222+
if [[ "${GITHUB_TRAFFIC_DIR}" == "" ]] ; then GITHUB_TRAFFIC_DIR=${DEFAULT_GITHUB_TRAFFIC_DIR} ; fi
223+
if [[ "${DEBUG}" == "1" ]] ; then new_message "${LINENO}" "DEBUG" " Variable... GITHUB_TRAFFIC_DIR >${GITHUB_TRAFFIC_DIR}<" 1>&2 ; fi
226224

227225
# Create log directory for crontab ${GITHUB_OWNER} jobs
228-
mkdir -p "${GITHUB_DATA_DIR}/${GITHUB_OWNER}/log" || { new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${GITHUB_DATA_DIR}/${GITHUB_OWNER} was not created maybe permission incident." 1>&2 ; exit 1; }
226+
mkdir -p "${GITHUB_TRAFFIC_DIR}/${GITHUB_OWNER}/log" || { new_message "${LINENO}" "${RED}ERROR${WHITE}" " ${GITHUB_TRAFFIC_DIR}/${GITHUB_OWNER} was not created maybe permission incident." 1>&2 ; exit 1; }
229227

230228
# Check if github.repository.list file size>0 and the file is readable
231229
if [[ ! -s "github.repository.list" ]] && [[ -r "github.repository.list" ]] ; then
232230
new_message "${LINENO}" "${RED}ERROR${WHITE}" " github.repository.list file does not exist in directory or is not size>0 or is not readable. github.repository.list file should include Github owner's repository names, one per line." 1>&2
233231
exit 1
234232
fi
235-
cp -p github.repository.list "${GITHUB_DATA_DIR}"
233+
cp -p github.repository.list "${GITHUB_TRAFFIC_DIR}"
236234

237235
# Check if owner.repository file size>0 and the file is readable
238236
if [[ ! -s "owner.repository" ]] && [[ -r "owner.repository" ]] ; then
239237
new_message "${LINENO}" "${RED}ERROR${WHITE}" " owner.repository file does not exist in directory or is not size>0 or is not readable" 1>&2
240238
exit 1
241239
fi
242-
cp -p owner.repository "${GITHUB_DATA_DIR}"
243-
cp -p setup.github.repository.sh "${GITHUB_DATA_DIR}"
240+
cp -p owner.repository "${GITHUB_TRAFFIC_DIR}"
241+
cp -p setup.github.repository.sh "${GITHUB_TRAFFIC_DIR}"
244242

245243
# Check if parse.repository.data.sh file size>0 and the file has execute permission
246244
if [[ ! -s "parse.repository.data.sh" ]] && [[ -x "parse.repository.data.sh" ]] ; then
247245
new_message "${LINENO}" "${RED}ERROR${WHITE}" " parse.repository.data.sh file does not exist in directory or is not size>0 or is not executable" 1>&2
248246
exit 1
249247
fi
250-
cp -p parse.repository.data.sh "${GITHUB_DATA_DIR}"
248+
cp -p parse.repository.data.sh "${GITHUB_TRAFFIC_DIR}"
251249

252250
# Check if clone.heading file size>0 and the file is readable
253251
if [[ ! -s "clone.heading" ]] && [[ -r "clone.heading" ]] ; then
254252
new_message "${LINENO}" "${RED}ERROR${WHITE}" " clone.heading file does not exist in directory or is not size>0 or is not readable" 1>&2
255253
exit 1
256254
fi
257-
cp -p clone.heading "${GITHUB_DATA_DIR}"
255+
cp -p clone.heading "${GITHUB_TRAFFIC_DIR}"
258256

259257
# Check if view.heading file size>0 and the file is readable
260258
if [[ ! -s "view.heading" ]] && [[ -r "view.heading" ]] ; then
261259
new_message "${LINENO}" "${RED}ERROR${WHITE}" " view.heading file does not exist in directory or is not size>0 or is not readable" 1>&2
262260
exit 1
263261
fi
264-
cp -p view.heading "${GITHUB_DATA_DIR}"
262+
cp -p view.heading "${GITHUB_TRAFFIC_DIR}"
265263

266-
cd "${GITHUB_DATA_DIR}"
264+
cd "${GITHUB_TRAFFIC_DIR}"
267265
echo "${BOLD}${YELLOW}Add the follow line(s) to crontab using crontab -e ----->${CYAN}"
268266
# Loop through repository names in github.repository.list
269-
for REPOSITORY in $(cat "${GITHUB_DATA_DIR}"/github.repository.list | grep -v "#" ); do
267+
for REPOSITORY in $(cat "${GITHUB_TRAFFIC_DIR}"/github.repository.list | grep -v "#" ); do
270268
# Create symbolic link owner.repository <-- for(repository.list) to BradleyA.Start-registry-v2-script.1.0
271269
ln -sf ../owner.repository "${GITHUB_OWNER}/${GITHUB_OWNER}.${REPOSITORY}"
272-
echo "20 12 * * MON ${GITHUB_DATA_DIR}/${GITHUB_OWNER}/${GITHUB_OWNER}.${REPOSITORY} >> ${GITHUB_DATA_DIR}/${GITHUB_OWNER}/log/${GITHUB_OWNER}.${REPOSITORY}-crontab" 2>&1
270+
echo "20 12 * * MON ${GITHUB_TRAFFIC_DIR}/${GITHUB_OWNER}/${GITHUB_OWNER}.${REPOSITORY} >> ${GITHUB_TRAFFIC_DIR}/${GITHUB_OWNER}/log/${GITHUB_OWNER}.${REPOSITORY}-crontab" 2>&1
273271

274272
# >>> Remove when complete #40
275273
# tmp_file=$(mktemp repository.data.crontab.XXX) #### add before for loop

0 commit comments

Comments
 (0)