Last active
July 14, 2017 23:19
-
-
Save dhil/70e08d82f1f49cb94b987a9c4f799cea to your computer and use it in GitHub Desktop.
Links Systemd service unit
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
make_cache=false | |
use_cache=false | |
cache_directory=$LINKSHOME/cache | |
prelude=$LINKSHOME/prelude.links | |
jslibdir=$LINKSHOME/lib/js | |
jsliburl=/lib/ | |
database_args=:links: | |
database_driver=postgresql | |
port=10088 | |
js_pretty_print=true | |
serialiser=Dump | |
enable_handlers=true |
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
[Unit] | |
Description=Links webserver | |
Requires=postgresql.service | |
[Service] | |
Type=simple | |
User=links | |
Group=links | |
WorkingDirectory=/var/www/links | |
ExecStart=/var/www/links/runlinks | |
Environment=LINKSHOME=/var/www/links | |
[Install] | |
WantedBy=multi-user.target |
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] | |
CONFIG="$LINKSHOME/handlers.config" | |
LINKSPATH="$LINKSHOME/examples:$LINKSHOME/examples/games:$LINKSHOME/examples/handlers" | |
PROG=$1 | |
DEBUG="" | |
if [[ $1 = "debug" ]]; then | |
DEBUG="-d" | |
PROG=$2 | |
fi | |
PROG=$(test -z $PROG && echo "$LINKSHOME/examples/webserver/examples-nodb.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 -m --path=$LINKSPATH $PROG | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The systemd service unit
links.service
runs the Links startup scriptrunlinks
(from directory/var/www/links
) as a unprivileged system userlinks
.