Create a template service file at /etc/systemd/system/secure-tunnel@.service
. The template parameter will correspond to the name
of target host:
[Unit]
Description=Setup a secure tunnel to %I
After=network.target
#! /bin/sh | |
if test "$2" = ""; then | |
echo "usage: $0 basedir depth" | |
exit 1 | |
fi | |
if test "$2" = "0"; then | |
exit 0 | |
fi |
""" | |
Simple backend for nginx memcached module | |
Written by Wojtek 'suda' Siudzinski <admin@suda.pl> | |
Gist: https://gist.github.com/701904 | |
Nginx config: | |
location /static { | |
add_header X-Origin Memcached; | |
expires modified +48h; |
import gevent | |
from gevent import monkey | |
monkey.patch_socket() | |
import hashlib | |
import os | |
import redis | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Haochi Chen <http://ihaochi.com> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
Services declared as oneshot
are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo
service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh
:
This is an example of a socket-activated per-connection service (which is usually referred to as inetd-like service). A thorough explanation can be found at http://0pointer.de/blog/projects/inetd.html.
The key point here is to specify Accept=yes
, which will make the socket accept connections (behaving like inetd) and pass
only the resulting connection socket to the service handler.
Timers provided by systemd can be used as cronjob replacements. More at man systemd.timer
.
Suppose we want to periodically trigger cleanup tasks for a baz
utility. We 'll create a baz-cleanup.service
which will
be triggered by a baz-cleanup.timer
.
Create a minimal service at /etc/systemd/system/baz-cleanup.service
: