summaryrefslogtreecommitdiff
path: root/prolog
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-10-05 20:13:08 +0200
committerAleš Smodiš <aless@guru.si>2015-10-05 20:13:08 +0200
commitb899cfb6a5b58a8cf4e22bd2eea069c4fe4121c1 (patch)
treee97725cc148e916b0459a3c6e18e2ec02ea6b01a /prolog
parent4586cb0e9d6cc862176314dcaa29edfea3c8eb4d (diff)
Add the prolog runner to be used for daemonisation in init scripts.
Diffstat (limited to 'prolog')
-rwxr-xr-xprolog/runner/daemon.pl25
1 files changed, 25 insertions, 0 deletions
diff --git a/prolog/runner/daemon.pl b/prolog/runner/daemon.pl
new file mode 100755
index 0000000..b079d94
--- /dev/null
+++ b/prolog/runner/daemon.pl
@@ -0,0 +1,25 @@
+#!/usr/bin/swipl -q --nosignals -tty -s
+
+% Pengine and HTTP server modules.
+:- use_module(library(http/http_dispatch)).
+:- use_module(library(http/http_error)).
+:- use_module(library(http/thread_httpd)).
+:- use_module(library(http/http_unix_daemon)).
+:- use_module(library(pengines)).
+:- use_module(library(pengines_io)).
+
+:- use_module(library(clpfd)).
+:- use_module(library(clpr)).
+
+:- consult(sandbox).
+
+:- multifile prolog:error_message/3.
+prolog:error_message(time_limit_exceeded) -->
+ [ 'time limit exceeded' ].
+
+:- set_setting(pengine_sandbox:time_limit, 5.0).
+:- set_setting(pengine_sandbox:thread_pool_size, 50).
+
+% Start the server. Set fork(true) if you desire for the process to fork into background. You may also want pidfile(filename).
+% See /usr/lib/swi-prolog/library/http/http_unix_daemon.pl and thread_httpd.pl for all options.
+:- http_daemon([port(3030), ip(localhost), fork(false), workers(10), timeout(30), keep_alive_timeout(30), user(nobody), group(nogroup)]).