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