Make services reloading systemd-agnostic

This commit is contained in:
Miraty 2022-11-23 22:21:34 +01:00
parent 83f9a05875
commit dc3c976d37
5 changed files with 9 additions and 11 deletions

View File

@ -55,7 +55,7 @@ See [the issue tracker](https://code.antopie.org/niver/niver/issues).
[sudo](https://www.sudo.ws/) 1.9.10+
: execute actions that match a regex as privileged or specific users
SFTPGo
[SFTPGo](https://github.com/drakkan/sftpgo)
: upload sites files using SFTP
[nginx](https://nginx.org/)
@ -70,9 +70,6 @@ Tor
[GNU Core Utilities](https://www.gnu.org/software/coreutils/)
: manipulate the filesystem through sudo
systemd
: reload Tor and nginx services when configuration is changed when a site is added/deleted
## Installation
There is currently no proper documentation to install Niver, but you can create a system image or look at configuration files and scripts from [niver-mkosi](https://code.antopie.org/niver/niver-mkosi).

View File

@ -31,15 +31,16 @@ enabled = true
ht_path = "/srv/niver/ht"
; Nginx configuration directory
nginx_config_path = "/srv/niver/nginx"
nginx_reload_cmd = "/usr/bin/systemctl reload nginx"
; Tor configuration directory
tor_config_path = "/srv/niver/tor-config"
; Tor keys directory
tor_keys_path = "/srv/niver/tor-keys"
tor_service = "tor"
tor_user = "tor"
tor_reload_cmd = "/usr/bin/systemctl reload tor"
sudo_path = "/usr/bin/sudo"
systemctl_path = "/usr/bin/systemctl"
certbot_path = "/usr/bin/certbot"
chgrp_path = "/usr/bin/chgrp"
cat_path = "/usr/bin/cat"

View File

@ -52,7 +52,7 @@ function htDeleteSite($dir, $domainType, $protocol) {
output(500, 'Failed to delete Tor configuration.');
// Reload Tor
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['systemctl_path'] . ' reload ' . CONF['ht']['tor_service'], $output, $code);
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['tor_reload_cmd'], $output, $code);
if ($code !== 0)
output(500, 'Failed to reload Tor.');
@ -73,7 +73,7 @@ function htDeleteSite($dir, $domainType, $protocol) {
output(500, 'Failed to delete Nginx configuration.');
// Reload Nginx
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['systemctl_path'] . ' reload nginx', result_code: $code);
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['nginx_reload_cmd'], result_code: $code);
if ($code !== 0)
output(500, 'Failed to reload Nginx.');

View File

@ -58,7 +58,7 @@ if (processForm()) {
output(500, 'Failed to write Nginx configuration.');
// Reload Nginx
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['systemctl_path'] . ' reload nginx', result_code: $code);
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['nginx_reload_cmd'], result_code: $code);
if ($code !== 0)
output(500, 'Failed to reload Nginx.');

View File

@ -19,7 +19,7 @@ if (processForm()) {
output(500, 'Failed to write new Tor configuration.');
// Reload Tor
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['systemctl_path'] . ' reload ' . CONF['ht']['tor_service'], $output, $code);
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['tor_reload_cmd'], $output, $code);
if ($code !== 0)
output(500, 'Failed to reload Tor.');
@ -45,7 +45,7 @@ if (processForm()) {
output(500, 'Failed to write Nginx configuration.');
// Reload Nginx
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['systemctl_path'] . ' reload nginx', result_code: $code);
exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['nginx_reload_cmd'], result_code: $code);
if ($code !== 0)
output(500, 'Failed to reload Nginx.');