diff --git a/CHANGELOG.md b/CHANGELOG.md index 48aecb65..5448e813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Applications which have not strictly enforced the identities may now have problems with validation and may need to be modified. ### Minor changes: +* Added systemd example files under example/systemd * Changed `plugin_init()` backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled. * Dedicated standalone xml,json,yang and xsl parser utility test programs added under lib/src/. * CDATA xml support (patch by David Cornejo, Netgate) diff --git a/apps/restconf/README.md b/apps/restconf/README.md index d6c69b89..7c5cc03e 100644 --- a/apps/restconf/README.md +++ b/apps/restconf/README.md @@ -2,7 +2,7 @@ ### Installation using Nginx -Define nginx config file/etc/nginx/sites-available/default +Define nginx config file: /etc/nginx/sites-available/default ``` server { ... diff --git a/doc/FAQ.md b/doc/FAQ.md index 09459599..1884a246 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -24,7 +24,7 @@ Clixon is written in C. The plugins are written in C. The CLI specification uses cligen (http://cligen.se) ## How to best understand Clixon? -Run the Clixon example, in the example directory. +Run the Clixon example, in the [example](../example) directory. ## How do you build and install Clixon (and the example)? Clixon: @@ -178,6 +178,11 @@ You may also add a default method in the configuration file: ``` +## Can I use systemd with Clixon? + +Yes. Systemd example files are provide for the backend and the +restconf daemon as part of the [example](../example/systemd). + ## How can I add extra XML? There are two ways to add extra XML to running database after start. Note that this XML is not "committed" into running. @@ -345,7 +350,7 @@ To authenticate, the callback needs to return the value 1 and supply a username. See [../apps/example/example_restconf.c] example_restconf_credentials() for an example of HTTP basic auth. -## How do I write a CLI translator function +## How do I write a CLI translator function? The CLI can perform variable translation. This is useful if you want to prcess the input, such as hashing, encrypting or in other way diff --git a/example/README.md b/example/README.md index e373476b..3622612d 100644 --- a/example/README.md +++ b/example/README.md @@ -188,6 +188,10 @@ The example contains some stubs for authorization according to [RFC8341(NACM)](h * A NACM backend plugin reporting the mandatory NACM state variables. +## Systemd files + +Example systemd files for backend and restconf daemons are found under the systemd directory. Install them under /etc/systemd/system for example. + ## Run as docker container (Note not updated) diff --git a/example/systemd/example.service b/example/systemd/example.service new file mode 100644 index 00000000..0bc4130d --- /dev/null +++ b/example/systemd/example.service @@ -0,0 +1,13 @@ +[Unit] +Description=Starts and stops a clixon example service on this system +Wants=example_restconf.service + +[Service] +Type=forking +User=root +RestartSec=60 +Restart=on-failure +ExecStart=/usr/local/sbin/clixon_backend -s running -f /usr/local/etc/example.xml + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/example/systemd/example_restconf.service b/example/systemd/example_restconf.service new file mode 100644 index 00000000..d47ff885 --- /dev/null +++ b/example/systemd/example_restconf.service @@ -0,0 +1,14 @@ +[Unit] +Description=Starts and stops an example clixon restconf service on this system +Wants=example.service +After=example.service + +[Service] +Type=simple +User=www-data +WorkingDirectory=/www-data +Restart=on-failure +ExecStart=/www-data/clixon_restconf -f /usr/local/etc/example.xml + +[Install] +WantedBy=multi-user.target