Browse Source

Make services reloading systemd-agnostic

Miraty 2 years ago
parent
commit
dc3c976d37
5 changed files with 9 additions and 11 deletions
  1. 1 4
      README.md
  2. 3 2
      config.ini
  3. 2 2
      fn/ht.php
  4. 1 1
      pages/ht/add-http-dns.php
  5. 2 2
      pages/ht/add-http-onion.php

+ 1 - 4
README.md

@@ -55,7 +55,7 @@ See [the issue tracker](https://code.antopie.org/niver/niver/issues).
 [sudo](https://www.sudo.ws/) 1.9.10+
 [sudo](https://www.sudo.ws/) 1.9.10+
 : execute actions that match a regex as privileged or specific users
 : execute actions that match a regex as privileged or specific users
 
 
-SFTPGo
+[SFTPGo](https://github.com/drakkan/sftpgo)
 : upload sites files using SFTP
 : upload sites files using SFTP
 
 
 [nginx](https://nginx.org/)
 [nginx](https://nginx.org/)
@@ -70,9 +70,6 @@ Tor
 [GNU Core Utilities](https://www.gnu.org/software/coreutils/)
 [GNU Core Utilities](https://www.gnu.org/software/coreutils/)
 : manipulate the filesystem through sudo
 : manipulate the filesystem through sudo
 
 
-systemd
-: reload Tor and nginx services when configuration is changed when a site is added/deleted
-
 ## Installation
 ## 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).
 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).

+ 3 - 2
config.ini

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

+ 2 - 2
fn/ht.php

@@ -52,7 +52,7 @@ function htDeleteSite($dir, $domainType, $protocol) {
 			output(500, 'Failed to delete Tor configuration.');
 			output(500, 'Failed to delete Tor configuration.');
 
 
 		// Reload Tor
 		// 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)
 		if ($code !== 0)
 			output(500, 'Failed to reload Tor.');
 			output(500, 'Failed to reload Tor.');
 
 
@@ -73,7 +73,7 @@ function htDeleteSite($dir, $domainType, $protocol) {
 		output(500, 'Failed to delete Nginx configuration.');
 		output(500, 'Failed to delete Nginx configuration.');
 
 
 	// Reload Nginx
 	// 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)
 	if ($code !== 0)
 		output(500, 'Failed to reload Nginx.');
 		output(500, 'Failed to reload Nginx.');
 
 

+ 1 - 1
pages/ht/add-http-dns.php

@@ -58,7 +58,7 @@ if (processForm()) {
 		output(500, 'Failed to write Nginx configuration.');
 		output(500, 'Failed to write Nginx configuration.');
 
 
 	// Reload Nginx
 	// 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)
 	if ($code !== 0)
 		output(500, 'Failed to reload Nginx.');
 		output(500, 'Failed to reload Nginx.');
 
 

+ 2 - 2
pages/ht/add-http-onion.php

@@ -19,7 +19,7 @@ if (processForm()) {
 		output(500, 'Failed to write new Tor configuration.');
 		output(500, 'Failed to write new Tor configuration.');
 
 
 	// Reload Tor
 	// 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)
 	if ($code !== 0)
 		output(500, 'Failed to reload Tor.');
 		output(500, 'Failed to reload Tor.');
 
 
@@ -45,7 +45,7 @@ if (processForm()) {
 		output(500, 'Failed to write Nginx configuration.');
 		output(500, 'Failed to write Nginx configuration.');
 
 
 	// Reload Nginx
 	// 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)
 	if ($code !== 0)
 		output(500, 'Failed to reload Nginx.');
 		output(500, 'Failed to reload Nginx.');