-
Notifications
You must be signed in to change notification settings - Fork 16
/
daemon.pl
executable file
·50 lines (36 loc) · 1.53 KB
/
daemon.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/swipl
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Pengines is prepared to be combined with the SWI-Prolog library
library(http/http_unix_daemon). Pengines is started as a deamon using
% ./daemon.pl --port=Port [option ...]
See library(http/http_unix_daemon) for details. The directory =upstart=
contains an Ubuntu Linux upstart script. Perform the following steps to
make this work:
- Make sure this file (=daemon.pl=) is executable and that the #!
points to SWI-Prolog version 7.1.14 or later. Test this by running
% ./daemon.pl --help
- copy upstart/pengines.conf to /etc/init
- edit /etc/init/pengines.conf, notably the `chdir` line to point to
this directory.
- run `initctl reload-configuration`
- create directories `log` and `storage` with permissions 775 and
group set to the `www-data` group (see --user and --group of
daemon.pl).
- Start the server using
service pengines start
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
:- set_prolog_flag(verbose, silent).
:- use_module(library(settings)).
:- use_module(library(http/http_unix_daemon)).
:- use_module(library(http/http_log)).
:- use_module(library(http/http_dyn_workers)).
:- set_setting_default(http:logfile, 'log/httpd.log').
%% memlimit
%
% Limit the memory usage of the pengine server (to 8Gb).
memlimit :-
catch(rlimit(as, _, 8 000 000 000), E,
print_message(warning, E)).
:- initialization memlimit.
:- initialization load_settings('pengines.conf').
:- [load].