Last active
June 29, 2021 11:35
-
-
Save dhil/0552a01b3454768ca9fc720579155007 to your computer and use it in GitHub Desktop.
Links web application runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: runlinks [debug] [application.links] | |
LINKSHOME="$HOME/projects/links/my-links" | |
CONFIG="$LINKSHOME/handlers.config" | |
LINKSPATH="$LINKSHOME/examples:$LINKSHOME/examples/games:$LINKSHOME/examples/handlers:$LINKSHOME/examples/dictionary" | |
PROG=$1 | |
DEBUG="" | |
if [[ $1 = "debug" ]]; then | |
DEBUG="-d" | |
PROG=$2 | |
fi | |
PROG=$(test -z $PROG && echo "$LINKSHOME/examples/webserver/examples.links" || echo "$PROG") | |
if [ ! -f $PROG ]; then | |
echo "error: no such Links program '$PROG'." | |
exit 1 | |
fi | |
timestamp="$(date +'%R:%S%z%Z, %b %d, %Y')" | |
echo "Starting Links with parameters ($timestamp):" | |
printf "%4s debug=%s\n" "" $(test -z $DEBUG && echo "false" || echo "true") | |
printf "%4s config=%s\n" "" $CONFIG | |
printf "%4s path=%s\n" "" $LINKSPATH | |
printf "%4sprogram=%s\n\n" "" $PROG | |
$LINKSHOME/links --config=$CONFIG $DEBUG --path=$LINKSPATH $PROG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment