Compare commits
54 Commits
999a919a7f
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| f8d2e3ea08 | |||
| 6a367bebec | |||
| 219236f167 | |||
| 2feb3e88cc | |||
| a1a02500e4 | |||
| 5d9f57fec4 | |||
| 30a8041fa8 | |||
| ff1cf74a00 | |||
| 5ad44a8056 | |||
| b5ea457491 | |||
| eaf8d2e0bb | |||
| 616663ffe0 | |||
| 1cd182b3a9 | |||
| ccd4f4d051 | |||
| 8a8845d898 | |||
| 65be246673 | |||
| eabf56ed93 | |||
| d55b13ecbf | |||
| cc8a7710a1 | |||
| ad83090b05 | |||
| 684c237ac1 | |||
| 23c0090a47 | |||
| e57ec6de50 | |||
| c790dd6736 | |||
| 6e3666cea2 | |||
| 7379df38de | |||
| 2a915fec69 | |||
| fa0e9907ee | |||
| 2c3b5056ae | |||
| f5e0c39458 | |||
| 645093da36 | |||
| f57583b1a9 | |||
| 51b2ebf8e6 | |||
| 5a6d91296d | |||
| 5306cb78d3 | |||
| 749a018a6e | |||
| f212c41734 | |||
| cba46bfc23 | |||
| b734be4054 | |||
| 45915d2914 | |||
| 1fa30724d2 | |||
| 6def1a3007 | |||
| ed7c2b8b29 | |||
| 3fcd6af3a9 | |||
| 8507cbd189 | |||
| 8207702442 | |||
| 0ec47180e2 | |||
| c28f7a92d9 | |||
| 2d270542f0 | |||
| ba0cfe8b56 | |||
| fa8eef51ff | |||
| 730940b003 | |||
| 58fab1850b | |||
| a5b6227fef |
@@ -25,7 +25,7 @@ cd www
|
||||
|
||||
Then in a web browser, navigate to `localhost:8080`.
|
||||
|
||||
## TODO
|
||||
## TODO Items
|
||||
|
||||
All goals are currently completed.
|
||||
|
||||
|
||||
68
check_git.sh
Executable file
68
check_git.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-10-14 Hyperling
|
||||
# Copied cronjob.sh from env-docker/Config/Hugo-Example/files/ to use for this
|
||||
# project so that docker container can do periodic git pulls rather than having
|
||||
# to reload /rebuild the container each time a release is pushed out.
|
||||
|
||||
## Setup ##
|
||||
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
cd $DIR
|
||||
DIR="`pwd`"
|
||||
NAME="'$PROG'"
|
||||
|
||||
function log {
|
||||
echo -e "`date` : $NAME - $1"
|
||||
}
|
||||
|
||||
function kill-project {
|
||||
# Kill node.js which will complete run.sh and restart any Docker containers.
|
||||
# This is more intended towards Development and Stage sites since Production
|
||||
# will only see git changes when a pull request is manually completed.
|
||||
log "Stopping continuous processes!"
|
||||
pkill node
|
||||
}
|
||||
|
||||
function reload-project {
|
||||
# Not much to do, run.sh and main.js automatically uses the latest files.
|
||||
rm -v files/photos/index.html
|
||||
# TBD/TODO: Call check_photos.sh once it has been pulled from run.sh.
|
||||
log "Project reloaded successfully!"
|
||||
}
|
||||
|
||||
## Main ##
|
||||
|
||||
# Pull any updates, and if the project is already up to date, exit successfully.
|
||||
output="`git pull`"
|
||||
git_status="$?"
|
||||
|
||||
echo "$output" | grep -v "up to date"
|
||||
grep_status="$?"
|
||||
|
||||
log "Pull status is '$git_status', checking for changes is '$grep_status'."
|
||||
|
||||
# Check whether the continuously running jobs have been updated.
|
||||
echo "$output" | grep "main.js"
|
||||
main_changed="$?"
|
||||
echo "$output" | grep "run.sh"
|
||||
run_changed="$?"
|
||||
|
||||
# Determine where we've landed and whether we need to do anything.
|
||||
if [[ $git_status != 0 ]]; then
|
||||
log "*** ERROR: Git reported a failure! ***"
|
||||
exit 1
|
||||
elif [[ $git_status == 0 && ($main_changed == 0 || $run_changed == 0) ]]; then
|
||||
log "Either main ('$main_changed'), or run ('$run_changed') were changed!"
|
||||
kill-project
|
||||
elif [[ $git_status == 0 && $grep_status == 0 ]]; then
|
||||
reload-project
|
||||
elif [[ $git_status == 0 && $grep_status != 0 ]]; then
|
||||
log "Nothing to do. '$output'"
|
||||
else
|
||||
log "*** WARNING: Unknown Situation ***"
|
||||
fi
|
||||
|
||||
## Success! ##
|
||||
|
||||
exit 0
|
||||
46
check_photos.sh
Executable file
46
check_photos.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-10-15 Hyperling
|
||||
# Create script which does the photo checking so that it can be called by
|
||||
# scripts other than just run.sh, such as if it needs used in check_git.sh.
|
||||
|
||||
## Setup ##
|
||||
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
cd $DIR
|
||||
DIR="`pwd`"
|
||||
NAME="'$PROG'"
|
||||
|
||||
function log {
|
||||
echo -e "`date` : $NAME - $1"
|
||||
}
|
||||
|
||||
## Parameters ##
|
||||
|
||||
ports="$1"
|
||||
|
||||
## Main ##
|
||||
|
||||
count=1
|
||||
http_code=0
|
||||
port="${ports%% *}"
|
||||
photos_uri=":$port/photos/"
|
||||
beg_time="$SECONDS"
|
||||
while [[ $http_code != "200" ]]; do
|
||||
log "Sleeping for '$count' while waiting for $photos_uri to come up."
|
||||
sleep $count
|
||||
log "Checking if $photos_uri is available."
|
||||
http_code="`curl --silent --fail -w '\n%{http_code}' localhost$photos_uri | tail -n 1`"
|
||||
log "Check for $photos_uri responded with '$http_code'."
|
||||
if (( $count >= 10 )); then
|
||||
log "Giving up on loading $photos_uri after '$count' attempts."
|
||||
break
|
||||
else
|
||||
count=$(( count + 1 ))
|
||||
fi
|
||||
done
|
||||
end_time="$SECONDS"
|
||||
time="$(( $end_time - $beg_time ))"
|
||||
log "Finished checking for /photos/ after '$time' seconds."
|
||||
|
||||
exit 0
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Synonym for home page.
|
||||
-->
|
||||
<?php
|
||||
/* Synonym for home page. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Apps";
|
||||
}
|
||||
@@ -18,9 +16,9 @@
|
||||
Linux system administration from a young age.
|
||||
Much of my career has focused on back-end / database systems
|
||||
and optimizing workflows.
|
||||
I feel that I specialize in building systems with "no sharp edges",
|
||||
meaning that I make sure there isn't a way the user can hurt
|
||||
themselves or the system.
|
||||
I feel that I specialize in building systems with "no sharp
|
||||
edges", meaning that I test rigorously to ensure there aren't any
|
||||
ways the user can hurt themselves or the system.
|
||||
In my free time I enjoy learning new
|
||||
languages and writing apps for Android.
|
||||
</p>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Alias for where Books menu item should go.
|
||||
-->
|
||||
<?php
|
||||
/* Alias for where Books menu item should go. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Books";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Alias for the support page with a more common name.
|
||||
-->
|
||||
<?php
|
||||
/* Alias for the support page with a more common name. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Donate";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Page to provide links for Freedom eBook.
|
||||
-->
|
||||
<?php
|
||||
/* Page to provide links for Freedom eBook. */
|
||||
$GLOBALS["ADVISORY"] = false;
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Freedom";
|
||||
@@ -29,7 +27,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<p>
|
||||
Click the link below to download the 4-page PDF:
|
||||
Use the links below to download the 4-page PDF:
|
||||
</p>
|
||||
<ul class="indent">
|
||||
<li>
|
||||
@@ -58,13 +56,28 @@
|
||||
<p>
|
||||
Curious how I made it? Check out its Git repository:
|
||||
</p>
|
||||
<ul class="indent"><li>
|
||||
<a href="https://git.hyperling.com/me/ebook-freedom-flyer"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
[CODE] | Source Code
|
||||
</a>
|
||||
</li></ul>
|
||||
<ul class="indent">
|
||||
<li>
|
||||
<a href="https://git.hyperling.com/me/ebook-freedom-flyer"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
[CODE] | Source Code
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Here is the video it was announced in:
|
||||
</p>
|
||||
<ul class="indent">
|
||||
<li>
|
||||
<a href="https://odysee.com/@HyperVegan:2/20251003-Announcements:0"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
[Odysee] | HyperVegan: "Announcements: Skipped Midfest, Voluntary Sovereignty eBook, CheapRVLiving Interview"
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Page to provide ways people can support me.
|
||||
-->
|
||||
<?php
|
||||
$GLOBALS["ADVISORY"] = false;
|
||||
/* Page to provide ways people can support me. */
|
||||
//$GLOBALS["ADVISORY"] = false;
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Health";
|
||||
}
|
||||
@@ -30,7 +28,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<p>
|
||||
Click the link below to download the 10-page PDF:
|
||||
Use the links below to download the 10-page PDF:
|
||||
</p>
|
||||
<ul class="indent">
|
||||
<li>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
$show_advisory = false;
|
||||
$show_advisory = true;
|
||||
if ($show_advisory) echo '
|
||||
<div class="row">
|
||||
<p><!-- Gap Area --></p>
|
||||
</div>
|
||||
|
||||
<div class="row center" id="advisory">
|
||||
<div class="col-12 title">
|
||||
<i><h2>Announcements</h2></i>
|
||||
</div>
|
||||
<div class="row center title" id="advisory">
|
||||
<h2 class="col-12 title"><i class="purple">Latest Announcement</i></h2>
|
||||
<a href="/freedom/">
|
||||
<div class="col-12 text">
|
||||
<u class="orange">2025-09-28</u>
|
||||
|
||||
@@ -6,32 +6,19 @@
|
||||
}
|
||||
$show_pics = $GLOBALS["SHOW_BANNER_PICS"];
|
||||
$banner_width = $show_pics ? 6 : 12;
|
||||
|
||||
// TBD / TODO:
|
||||
// Check if user has vertical screen?
|
||||
// Is that possible in this environment?
|
||||
//$image_width = $vertical_screen ? 6 : 3;
|
||||
?>
|
||||
<a href='/about/'>
|
||||
<div class="row">
|
||||
<?php if ($show_pics) echo '
|
||||
<div class="col-3 header center banner-image banner-image01">
|
||||
<!-<img src="/files/media/icons/home.jpg"
|
||||
alt="<<banner01.jpg>>"
|
||||
>-->
|
||||
</div>
|
||||
';?>
|
||||
<div class="col-<?php echo "$banner_width"; ?> header">
|
||||
<div class="banner-top">Peace</div>
|
||||
<div class="banner-middle">Love</div>
|
||||
<div class="banner-bottom">Happiness</div>
|
||||
</div>
|
||||
<?php if ($show_pics) echo '
|
||||
<div class="col-3 header center banner-image banner-image02">
|
||||
<!--<img src="/files/media/icons/contact.jpg"
|
||||
alt="<<banner02.jpg>>"
|
||||
>-->
|
||||
</div>
|
||||
';?>
|
||||
<?php if ($show_pics) echo '
|
||||
<div class="col-3 header center banner-image banner-image01"></div>
|
||||
';?>
|
||||
<div class="col-<?php echo "$banner_width"; ?> header">
|
||||
<div class="banner-top">Peace</div>
|
||||
<div class="banner-middle">Love</div>
|
||||
<div class="banner-bottom">Happiness</div>
|
||||
</div>
|
||||
<?php if ($show_pics) echo '
|
||||
<div class="col-3 header center banner-image banner-image02"></div>
|
||||
';?>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
<?php include "banner.css"; ?>
|
||||
</style>
|
||||
|
||||
<meta property="og:title" content="Hyperling"/>
|
||||
<meta property="og:description" content="Apps, eBooks, media, and other resources from the brands Hyperling and HyperVegan."/>
|
||||
<meta property="og:site_name" content="Hyperling"/>
|
||||
<meta property="og:url" content="https://hyperling.com/"/>
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:image" content="https://hyperling.com/files/media/icons/home.jpg"/>
|
||||
<meta name="referrer" content="same-origin"/>
|
||||
<meta property="og:title" content="Hyperling">
|
||||
<meta property="og:description" content="Apps, eBooks, media, and other resources from the brands Hyperling and HyperVegan.">
|
||||
<meta property="og:site_name" content="Hyperling">
|
||||
<meta property="og:url" content="https://hyperling.com/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content="https://hyperling.com/files/media/icons/home.jpg">
|
||||
<meta name="referrer" content="same-origin">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Hyperling" />
|
||||
<meta name="twitter:description" content="Apps, eBooks, media, and other resources from the brands Hyperling and HyperVegan." />
|
||||
<meta name="twitter:image" content="https://hyperling.com/files/media/icons/home.jpg" />
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="Hyperling">
|
||||
<meta name="twitter:description" content="Apps, eBooks, media, and other resources from the brands Hyperling and HyperVegan.">
|
||||
<meta name="twitter:image" content="https://hyperling.com/files/media/icons/home.jpg">
|
||||
</head>
|
||||
|
||||
@@ -16,4 +16,20 @@
|
||||
</li>
|
||||
<li class="col-3 menu-item"><a href="/photos/">Photos</a></li>
|
||||
</ul>
|
||||
<!--
|
||||
<ul class="menu-list">
|
||||
<li class="col-3 menu-item"></li>
|
||||
<li class="col-3 menu-item">
|
||||
<a href="https://blog.hyperling.com"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>Blog</a>
|
||||
</li>
|
||||
<li class="col-3 menu-item">
|
||||
<a href="https://recipes.hyperling.com"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>Recipes</a>
|
||||
</li>
|
||||
<li class="col-3 menu-item"></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Landing page, keeping it apps and development projects like old WordPress site.
|
||||
-->
|
||||
<?php
|
||||
/* Landing page, keeping it apps and development projects like old WordPress site. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Announcements";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Page for my video links.
|
||||
-->
|
||||
<?php
|
||||
/* Page for my video links. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Media";
|
||||
}
|
||||
@@ -35,11 +33,18 @@
|
||||
<p>
|
||||
I enjoy writing! Find my free eBooks below.
|
||||
</p>
|
||||
<ul class="indent"><li>
|
||||
2025-09-28: <a href="/freedom/">Voluntary Sovereignty</a>
|
||||
</li><li>
|
||||
2024-03-07: <a href="/health/">My Health Protocol</a>
|
||||
</li></ul>
|
||||
<ul class="indent">
|
||||
<li>
|
||||
2025-09-28: <a href="/freedom/">Voluntary Sovereignty</a> |
|
||||
Existing in a statist society with the least amount of friction.
|
||||
</li>
|
||||
<li><p><!-- Small Gap --></p></li>
|
||||
<li>
|
||||
2024-03-07: <a href="/health/">Hyperling's Health Protocol</a> |
|
||||
Health is a lifestyle, not a diet. Align yourself with Nature
|
||||
to receive its blessings.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Lists of items which I'd like to share such as gear and frequently used apps.
|
||||
-->
|
||||
<?php
|
||||
/* Lists of items which I'd like to share such as gear and frequently used apps. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Resources";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Page for my resume and work skill links.
|
||||
-->
|
||||
<?php
|
||||
/* Page for my resume and work skill links. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Resume";
|
||||
}
|
||||
@@ -10,6 +8,8 @@
|
||||
?>
|
||||
<div class="row">
|
||||
<h1 class="col-12 title">Resume</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h2 class="col-12 title center">Current Status : Traveling Full Time</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -17,22 +17,13 @@
|
||||
<p>
|
||||
Interested in hiring me? View my resume below!
|
||||
</p>
|
||||
<ul class="indent"><li>
|
||||
<!--<ul class="indent"><li>-->
|
||||
<a href="https://hyperling.com/files/media/documents/Resume.pdf"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
[PDF] | Direct Download
|
||||
</a>
|
||||
</li></ul>
|
||||
<!-- For those sneaky folks who look at source code. ;)
|
||||
<ul class="indent"><li>
|
||||
<a href="https://hyperling.com/files/media/documents/resume.md"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
>
|
||||
[Markdown] | Direct Download
|
||||
</a>
|
||||
</li></ul>
|
||||
-->
|
||||
<!--</li></ul>-->
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
$long = true;
|
||||
?>
|
||||
<div class="row" id="obtainium">
|
||||
<h2 class="col-12 header">All Announcements</h2>
|
||||
<h2 class="col-12 header">Announcements</h2>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<a href="/freedom/">2025-09-28</a>
|
||||
<strong><a href="/freedom/">2025-09-28</a></strong>
|
||||
<p>
|
||||
I wrote another short free eBook, "Voluntary Sovereignty", check it out
|
||||
<a href="/freedom/">here</a>!
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<a href="/apps/#expense">2025-05-XX</a>
|
||||
<strong><a href="/apps/#expense">2025-03-27</a></strong>
|
||||
<p>
|
||||
My new Android app
|
||||
<a href="/apps/#expense">"Expense Tracker"</a>
|
||||
@@ -54,12 +54,11 @@
|
||||
>Watch the announcement here | (HyperVegan: "Expense Tracker App")</a>
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<a href="/health/">2024-03-07</a>
|
||||
<strong><a href="/health/">2024-03-07</a></strong>
|
||||
<p>
|
||||
Find my free eBook, "Hyperling's Health Protocol",
|
||||
<a href="/health/">here</a>!
|
||||
@@ -86,7 +85,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text">
|
||||
<a href="/apps/#tictactoe">2024-03-31</a>
|
||||
<strong><a href="/apps/#tictactoe">2024-03-31</a></strong>
|
||||
<p>
|
||||
There's a new app in town,
|
||||
<a href="/apps/#tictactoe">Tic-Tac-Toe</a>!
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Page to provide ways people can support me.
|
||||
-->
|
||||
<?php
|
||||
/* Page to provide ways people can support me. */
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Support";
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/php
|
||||
<!--
|
||||
Old page for my video links.
|
||||
Deprecated 2024-03-06 for /media.
|
||||
-->
|
||||
<?php
|
||||
/*
|
||||
Old page for my video links.
|
||||
Deprecated 2024-03-06 for /media.
|
||||
*/
|
||||
if (!isset($GLOBALS["HEADER_TITLE"])) {
|
||||
$GLOBALS["HEADER_TITLE"] = "Videos";
|
||||
}
|
||||
|
||||
78
run.sh
78
run.sh
@@ -4,8 +4,14 @@
|
||||
|
||||
## Setup ##
|
||||
|
||||
DIR=`dirname $0`
|
||||
PROG=`basename $0`
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
|
||||
# Ensure we are executing from this file's directory.
|
||||
cd $DIR
|
||||
DIR="`pwd`"
|
||||
NAME="'$DIR/$PROG'"
|
||||
echo $NAME
|
||||
|
||||
## Functions ##
|
||||
|
||||
@@ -26,6 +32,22 @@ function log {
|
||||
echo -e "`date` - $message"
|
||||
}
|
||||
|
||||
log "Local process information:"
|
||||
ps $$
|
||||
function check_main {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "ERROR: Subprocess name was not provided. $1"
|
||||
exit 0
|
||||
fi
|
||||
log "Subprocess '$1' checking if main process is still running..."
|
||||
ps $$ >/dev/null
|
||||
status=$?
|
||||
if [[ $status != 0 ]]; then
|
||||
log "Process '$$' not found, '$1' from '$DIR/$PROG' exiting."
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
## Parameters ##
|
||||
|
||||
while getopts ':p:h' opt; do
|
||||
@@ -47,9 +69,6 @@ fi
|
||||
|
||||
## Build Environment ##
|
||||
|
||||
# Ensure we are executing from this file's directory.
|
||||
cd $DIR
|
||||
|
||||
sudo=""
|
||||
if [[ -z $LOGNAME ]]; then
|
||||
LOGNAME="`whoami`"
|
||||
@@ -60,21 +79,29 @@ if [[ $LOGNAME != "root" ]]; then
|
||||
fi
|
||||
|
||||
log "Check if any system dependencies need installed."
|
||||
progs=""
|
||||
if [[ ! `which php` ]]; then
|
||||
echo "- Installing PHP"
|
||||
$sudo apt-get install -y php-cli
|
||||
progs="$progs php-cli"
|
||||
fi
|
||||
if [[ ! `which node` ]]; then
|
||||
echo "- Installing Node"
|
||||
$sudo apt-get install -y nodejs
|
||||
progs="$progs nodejs"
|
||||
fi
|
||||
if [[ ! `which npm` ]]; then
|
||||
echo "- Installing NPM"
|
||||
$sudo apt-get install -y npm
|
||||
progs="$progs npm"
|
||||
fi
|
||||
if [[ ! `which curl` ]]; then
|
||||
echo "- Installing Curl"
|
||||
$sudo apt-get install -y curl
|
||||
progs="$progs curl"
|
||||
fi
|
||||
if [[ ! `which ps` ]]; then
|
||||
echo "- Installing PS"
|
||||
progs="$progs procps"
|
||||
fi
|
||||
if [[ -n "$progs" ]]; then
|
||||
$sudo apt-get install -y $progs
|
||||
fi
|
||||
|
||||
# Directories and allowed page types are executable, others are not.
|
||||
@@ -95,36 +122,27 @@ npm install
|
||||
log "Removing old index files."
|
||||
find files/photos/ -name "*".html -print -delete
|
||||
{
|
||||
count=1
|
||||
http_code=0
|
||||
port="${ports%% *}"
|
||||
photos_uri=":$port/photos/"
|
||||
beg_time="$SECONDS"
|
||||
while [[ $http_code != "200" ]]; do
|
||||
log "Sleeping for '$count' while waiting for $photos_uri to come up."
|
||||
sleep $count
|
||||
log "Checking if $photos_uri is available."
|
||||
http_code="`curl --silent --fail -w '\n%{http_code}' localhost$photos_uri | tail -n 1`"
|
||||
log "Check for $photos_uri responded with '$http_code'."
|
||||
if (( $count >= 10 )); then
|
||||
log "Giving up on loading $photos_uri after '$count' attempts."
|
||||
break
|
||||
else
|
||||
count=$(( count + 1 ))
|
||||
fi
|
||||
done
|
||||
end_time="$SECONDS"
|
||||
time="$(( $end_time - $beg_time ))"
|
||||
log "Finished checking for /photos/ after '$time' seconds."
|
||||
check_main photos
|
||||
$DIR/check_photos.sh "$ports"
|
||||
} &
|
||||
|
||||
## Main ##
|
||||
|
||||
log "Start check_git."
|
||||
while true; do
|
||||
check_main check_git
|
||||
$DIR/check_git.sh
|
||||
sleep 30
|
||||
done &
|
||||
|
||||
log "Start website API."
|
||||
node ./main.js $ports
|
||||
status=$?
|
||||
|
||||
## Finish ##
|
||||
|
||||
log "Kill spawned processes."
|
||||
pkill -eP $$
|
||||
|
||||
log "Exiting with status '$status'."
|
||||
exit $status
|
||||
|
||||
Reference in New Issue
Block a user