pad.pub0.org/bin/run.sh

45 lines
1.1 KiB
Bash
Raw Normal View History

2011-06-02 12:43:34 +00:00
#!/bin/bash
2011-06-02 12:43:34 +00:00
#Stop the script if its started as root
2011-04-07 13:51:46 +00:00
if [[ $EUID -eq 0 ]]; then
echo "You shouldn't start Etherpad-Lite as root!" 1>&2
echo "Use authbind if you want to use a port lower than 1024 -> http://en.wikipedia.org/wiki/Authbind" 1>&2
exit 1
fi
2011-03-26 13:10:41 +00:00
2011-06-02 12:43:34 +00:00
#Is node installed?
2011-04-07 13:51:46 +00:00
type -P node &>/dev/null || {
echo "You need to install node to run Etherpad-Lite!" >&2
exit 1
}
2011-03-26 13:10:41 +00:00
2011-06-02 12:43:34 +00:00
#Is node installed?
type -P npm &>/dev/null || {
echo "You need to install npmq to run Etherpad-Lite!" >&2
exit 1
}
#Was this script started in the bin folder? if yes move out
if [ -d "../bin" ]; then
cd "../"
fi
2011-06-02 12:43:34 +00:00
#Does a settings.json exist? if no copy the template
2011-06-02 11:15:02 +00:00
if [ ! -f "settings.json" ]; then
2011-06-02 12:43:34 +00:00
echo "Copy the settings template to settings.json..."
cp -v settings.json.template settings.json
2011-06-02 11:15:02 +00:00
fi
2011-06-02 12:43:34 +00:00
#Remove all minified data to force node creating it new
echo "Clear minfified cache..."
rm var/minified* 2> /dev/null
#Ensure all dependencies are installed
echo "Ensure dependencies are up to date..."
npm link
#Move to the node folder and start
echo "start..."
cd "node"
2011-04-07 13:51:46 +00:00
node server.js