changeset 7:246f0c73507a

A few more bits.
author samer
date Sun, 18 Jan 2015 21:19:34 +0000
parents b39b8b8f7e83
children d364e8ee791c
files var/dml/daemon.pl var/dml/etc var/dml/run.pl
diffstat 3 files changed, 115 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/var/dml/daemon.pl	Sun Jan 18 21:19:34 2015 +0000
@@ -0,0 +1,47 @@
+#!/usr/local/bin/swipl
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ClioPatria is prepared to be combined with the SWI-Prolog library
+library(http/http_unix_daemon).  ClioPatria is started as a deamon
+using
+
+  % ./daemon.pl --port=Port [option ...]
+
+Options are briefly described by running the daemon with --help:
+
+  % ./daemon.pl --help
+
+See library(http/http_unix_daemon) for details.  The SWI-Prolog
+distribution contains a file debian-init-script, which can be
+used as a skeleton for managing the server from /etc/init.d.  To
+do so, follow these steps:
+
+  1. copy debian-init-script to /etc/init.d/<server>.  This
+     script is in the directory doc/packages/examples/http of
+     your Prolog installation.
+  2. Edit /etc/init.d/<server>, setting DIR to the working
+     directory of the ClioPatria server.
+  3. Edit the remainder of the configuration section to suit
+     your needs.
+  4. Run
+       % update-rc.d <server> defaults
+       % /etc/init.d/<server> start
+
+Permissions
+
+Ideally, the ClioPatria directory is owned by another user than the user
+used by the daemon. If the user of   the  daemon has no write access, it
+acts as a read-only service. Write access   may be given by changing the
+group of certain files to the  group   of  the daemon and allowing group
+write.  You may want to add write access to
+
+  - The RDF-store directory to allow adding persistent triples (otherwise
+    tiples may be added, but will not persist).
+  - The file settings.db to allow changing settings through the API.
+  - The file users.db to allow modifying the user database throuh th API
+  - The '.' directory to allow creating httpd.log.
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+:- set_prolog_flag(verbose, silent).
+:- use_module(library(http/http_unix_daemon)).
+:- [run].
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/var/dml/etc	Sun Jan 18 21:19:34 2015 +0000
@@ -0,0 +1,1 @@
+/home/dml/src/github/ClioPatria/etc
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/var/dml/run.pl	Sun Jan 18 21:19:34 2015 +0000
@@ -0,0 +1,67 @@
+#!/usr/local/bin/swipl
+
+:- initialization cp_server.
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+This file provides a skeleton startup file.  It can be localized by running
+
+    % ./configure			(Unix)
+    % Double-clicking win-config.exe	(Windows)
+
+After  that,  the  system  may  be  customized  by  copying  or  linking
+customization  files  from  config-available    to  config-enabled.  See
+config-enabled/README.txt for details.
+
+To run the system, do one of the following:
+
+    * Running for development
+      Run ./run.pl (Unix) or open run.pl by double clicking it (Windows)
+
+    * Running as Unix daemon (service)
+      See daemon.pl
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+% Setup search path for cliopatria. We add  both a relative and absolute
+% path. The absolute path allow us to  start in any directory, while the
+% relative one ensures that the system remains working when installed on
+% a device that may be mounted on a different location.
+
+add_relative_search_path(Alias, Abs) :-
+	is_absolute_file_name(Abs), !,
+	prolog_load_context(file, Here),
+	relative_file_name(Abs, Here, Rel),
+	assertz(user:file_search_path(Alias, Rel)).
+add_relative_search_path(Alias, Rel) :-
+	assertz(user:file_search_path(Alias, Rel)).
+
+file_search_path(cliopatria, '/home/dml/src/github/ClioPatria').
+:- add_relative_search_path(cliopatria, '/home/dml/src/github/ClioPatria').
+
+% Make loading files silent. Comment if you want verbose loading.
+
+:- current_prolog_flag(verbose, Verbose),
+   asserta(saved_verbose(Verbose)),
+   set_prolog_flag(verbose, silent).
+
+
+		 /*******************************
+		 *	      LOAD CODE		*
+		 *******************************/
+
+% Use the ClioPatria help system.  May   be  commented to disable online
+% help on the source-code.
+
+:- use_module(cliopatria('applications/help/load')).
+
+% Load ClioPatria itself.  Better keep this line.
+
+:- use_module(cliopatria(cliopatria)).
+
+% Get back normal verbosity of the toplevel.
+
+:- (   retract(saved_verbose(Verbose))
+   ->  set_prolog_flag(verbose, Verbose)
+   ;   true
+   ).
+
+