bin: Use consistent comment formatting
parent
be1f2152fc
commit
8e8b75be6c
|
@ -1,26 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
#Was this script started in the bin folder? if yes move out
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
||||
#Is wget installed?
|
||||
# Is wget installed?
|
||||
hash wget > /dev/null 2>&1 || {
|
||||
echo "Please install wget" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Is zip installed?
|
||||
# Is zip installed?
|
||||
hash zip > /dev/null 2>&1 || {
|
||||
echo "Please install zip" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Is zip installed?
|
||||
# Is zip installed?
|
||||
hash unzip > /dev/null 2>&1 || {
|
||||
echo "Please install unzip" >&2
|
||||
exit 1
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
#Was this script started in the bin folder? if yes move out
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
||||
#Prepare the environment
|
||||
# Prepare the environment
|
||||
bin/installDeps.sh || exit 1
|
||||
|
||||
echo "If you are new to debugging Node.js with Chrome DevTools, take a look at this page:"
|
||||
echo "https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27"
|
||||
echo "Open 'chrome://inspect' on Chrome to start debugging."
|
||||
|
||||
#Use 0.0.0.0 to allow external connections to the debugger
|
||||
#(ex: running Etherpad on a docker container). Use default port # (9229)
|
||||
# Use 0.0.0.0 to allow external connections to the debugger
|
||||
# (ex: running Etherpad on a docker container). Use default port # (9229)
|
||||
node --inspect=0.0.0.0:9229 node_modules/ep_etherpad-lite/node/server.js "$@"
|
||||
|
|
|
@ -48,39 +48,39 @@ require_minimal_version() {
|
|||
fi
|
||||
}
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
#Was this script started in the bin folder? if yes move out
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
||||
#Is node installed?
|
||||
#Not checking io.js, default installation creates a symbolic link to node
|
||||
# Is node installed?
|
||||
# Not checking io.js, default installation creates a symbolic link to node
|
||||
hash node > /dev/null 2>&1 || {
|
||||
echo "Please install node.js ( https://nodejs.org )" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Is npm installed?
|
||||
# Is npm installed?
|
||||
hash npm > /dev/null 2>&1 || {
|
||||
echo "Please install npm ( https://npmjs.org )" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Check npm version
|
||||
# Check npm version
|
||||
NPM_VERSION_STRING=$(npm --version)
|
||||
|
||||
require_minimal_version "npm" "$NPM_VERSION_STRING" "$REQUIRED_NPM_MAJOR" "$REQUIRED_NPM_MINOR"
|
||||
|
||||
#Check node version
|
||||
# Check node version
|
||||
NODE_VERSION_STRING=$(node --version)
|
||||
NODE_VERSION_STRING=${NODE_VERSION_STRING#"v"}
|
||||
|
||||
require_minimal_version "nodejs" "$NODE_VERSION_STRING" "$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
|
||||
|
||||
#Get the name of the settings file
|
||||
# Get the name of the settings file
|
||||
settings="settings.json"
|
||||
a='';
|
||||
for arg in "$@"; do
|
||||
|
@ -88,7 +88,7 @@ for arg in "$@"; do
|
|||
a=$arg
|
||||
done
|
||||
|
||||
#Does a $settings exist? if not copy the template
|
||||
# Does a $settings exist? if not copy the template
|
||||
if [ ! -f $settings ]; then
|
||||
echo "Copy the settings template to $settings..."
|
||||
cp settings.json.template $settings || exit 1
|
||||
|
@ -106,7 +106,7 @@ echo "Ensure that all dependencies are up to date... If this is the first time
|
|||
exit 1
|
||||
}
|
||||
|
||||
#Remove all minified data to force node creating it new
|
||||
# Remove all minified data to force node creating it new
|
||||
echo "Clearing minified cache..."
|
||||
rm -f var/minified*
|
||||
|
||||
|
|
11
bin/run.sh
11
bin/run.sh
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
#Was this script started in the bin folder? if yes move out
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
@ -16,7 +16,7 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
#Stop the script if it's started as root
|
||||
# Stop the script if it's started as root
|
||||
if [ "$(id -u)" -eq 0 ] && [ $ignoreRoot -eq 0 ]; then
|
||||
echo "You shouldn't start Etherpad as root!"
|
||||
echo "Please type 'Etherpad rocks my socks' or supply the '--root' argument if you still want to start it as root"
|
||||
|
@ -28,12 +28,11 @@ if [ "$(id -u)" -eq 0 ] && [ $ignoreRoot -eq 0 ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
#Prepare the environment
|
||||
# Prepare the environment
|
||||
bin/installDeps.sh "$@" || exit 1
|
||||
|
||||
#Move to the node folder and start
|
||||
# Move to the node folder and start
|
||||
echo "Started Etherpad..."
|
||||
|
||||
SCRIPTPATH=$(pwd -P)
|
||||
exec node "$SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js" "$@"
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
#This script ensures that ep-lite is automatically restarting after an error happens
|
||||
# This script ensures that ep-lite is automatically restarting after
|
||||
# an error happens
|
||||
|
||||
#Handling Errors
|
||||
# 0 silent
|
||||
# 1 email
|
||||
# Handling Errors
|
||||
# 0 silent
|
||||
# 1 email
|
||||
ERROR_HANDLING=0
|
||||
# Your email address which should receive the error messages
|
||||
EMAIL_ADDRESS="no-reply@example.com"
|
||||
|
@ -18,15 +19,15 @@ TIME_BETWEEN_EMAILS=600 # 10 minutes
|
|||
LAST_EMAIL_SEND=0
|
||||
LOG="$1"
|
||||
|
||||
#Move to the folder where ep-lite is installed
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
|
||||
#Was this script started in the bin folder? if yes move out
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
cd "../"
|
||||
fi
|
||||
|
||||
#Check if a logfile parameter is set
|
||||
# Check if a logfile parameter is set
|
||||
if [ -z "${LOG}" ]; then
|
||||
echo "Set a logfile as the first parameter"
|
||||
exit 1
|
||||
|
@ -35,21 +36,21 @@ fi
|
|||
shift
|
||||
while [ 1 ]
|
||||
do
|
||||
#Try to touch the file if it doesn't exist
|
||||
# Try to touch the file if it doesn't exist
|
||||
if [ ! -f ${LOG} ]; then
|
||||
touch ${LOG} || ( echo "Logfile '${LOG}' is not writeable" && exit 1 )
|
||||
fi
|
||||
|
||||
#Check if the file is writeable
|
||||
# Check if the file is writeable
|
||||
if [ ! -w ${LOG} ]; then
|
||||
echo "Logfile '${LOG}' is not writeable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Start the application
|
||||
# Start the application
|
||||
bin/run.sh $@ >>${LOG} 2>>${LOG}
|
||||
|
||||
#Send email
|
||||
# Send email
|
||||
if [ $ERROR_HANDLING = 1 ]; then
|
||||
TIME_NOW=$(date +%s)
|
||||
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))
|
||||
|
@ -63,6 +64,6 @@ do
|
|||
|
||||
echo "RESTART!" >>${LOG}
|
||||
|
||||
#Sleep 10 seconds before restart
|
||||
# Sleep 10 seconds before restart
|
||||
sleep 10
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue