Service sadness

I read this and it made me sad. Exposing CRUD API makes me sad. CRUD is for databases, within transactions, not services. Services should have query (GET) and submit (POST) only. Oh, and calling a service an API makes me sad. Calling a URL or its path an “endpoint” makes me sad. An endpoint is a computer which processes a message, it’s not a URL path. The idea of “routing” makes me sad. Using plurals in URLs makes me sad. Exposing hierarchies unnecessarily in URLs makes me sad. Business process which doesn’t cater for optimistic concurrency controls makes me sad.

Registering a systemd Service

So today I read How To Set Up VNC Server on Debian 8 which had a section on creating and registering the requisite scripts:

/usr/local/bin/myvncserver (make sure it’s executable with +x):

#!/bin/bash
PATH="$PATH:/usr/bin/"
DISPLAY="1"
DEPTH="16"
GEOMETRY="1024x768"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
case "$1" in
start)
/usr/bin/vncserver ${OPTIONS}
;;
stop)
/usr/bin/vncserver -kill :${DISPLAY}
;;
restart)
$0 stop
$0 start
;;
esac
exit 0

/lib/systemd/system/myvncserver.service:

[Unit]
Description=VNC Server example

[Service]
Type=forking
ExecStart=/usr/local/bin/myvncserver start
ExecStop=/usr/local/bin/myvncserver stop
ExecReload=/usr/local/bin/myvncserver restart
User=vnc

[Install]
WantedBy=multi-user.target

Then to register and start:

systemctl daemon-reload
systemctl enable myvncserver.service
systemctl start myvncserver.service