diff --git a/deploy/apache/docker-entrypoint b/deploy/apache/docker-entrypoint
index b59ffabac6..644a7a639f 100644
--- a/deploy/apache/docker-entrypoint
+++ b/deploy/apache/docker-entrypoint
@@ -117,7 +117,7 @@ echo "entrypoint -- Writing /var/www/docker_vars.json"
echo "{\"SOCKET_PORT\":${SOCKET_PORT}, \"HTTP_PORT\":${HTTP_PORT}, \"HTTPS_PORT\":${HTTPS_PORT}, \"SERVER_NAME\":\"${SERVER_NAME}\", \"NGINX_RTMP_PORT\":${NGINX_RTMP_PORT}, \"NGINX_HTTP_PORT\":${NGINX_HTTP_PORT}, \"NGINX_HTTPS_PORT\":${NGINX_HTTPS_PORT}}" > /var/www/docker_vars.json
echo "entrypoint -- Starting socket server..."
-ulimit -n 1048576 && nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
+nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
echo "Clear cache"
diff --git a/plugin/YPTSocket/YPTSocket.php b/plugin/YPTSocket/YPTSocket.php
index 37a25fda17..9d74573a77 100644
--- a/plugin/YPTSocket/YPTSocket.php
+++ b/plugin/YPTSocket/YPTSocket.php
@@ -20,9 +20,9 @@ class YPTSocket extends PluginAbstract
global $global;
$desc = '' . getSocketConnectionLabel() . ' ';
$desc .= "Socket Plugin, WebSockets allow for a higher amount of efficiency compared to REST because they do not require the HTTP request/response overhead for each message sent and received
";
- $desc .= "
To start it on server now ulimit -n 1048576 && sudo nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &
";
+ $desc .= "
To start it on server now sudo ".YPTSocket::getStartServerCommand()."
";
$desc .= "
To test use php {$global['systemRootPath']}plugin/YPTSocket/test.php
";
- $desc .= "
To start it on server reboot add it on your crontab (Ubuntu 18+) sudo crontab -eu root
than add this code on the last line @reboot sleep 60;nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &
";
+ $desc .= "
To start it on server reboot add it on your crontab (Ubuntu 18+) sudo crontab -eu root
than add this code on the last line @reboot sleep 60;".YPTSocket::getStartServerCommand()."
";
$desc .= "
If you use Certbot to renew your SSL use (Ubuntu 18+) sudo crontab -eu root
than add this code on the last line 0 1 * * * nohup php {$global['systemRootPath']}plugin/YPTSocket/serverCertbot.php &
";
$help = "
run this command start the server Help";
@@ -324,7 +324,15 @@ class YPTSocket extends PluginAbstract
global $global;
exec("php {$global['systemRootPath']}plugin/YPTSocket/stopServer.php");
exec("sleep 1");
- execAsync("ulimit -n 1048576 && nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &");
+ execAsync(YPTSocket::getStartServerCommand());
return true;
}
+
+
+ static public function getStartServerCommand()
+ {
+ global $global;
+ $command = "nohup bash -c 'ulimit -n 1048576 && php {$global['systemRootPath']}plugin/YPTSocket/server.php &'";
+ return $command;
+ }
}
diff --git a/plugin/YPTSocket/footer.php b/plugin/YPTSocket/footer.php
index 396f4dfefb..c9911301d7 100644
--- a/plugin/YPTSocket/footer.php
+++ b/plugin/YPTSocket/footer.php
@@ -23,7 +23,7 @@ if (!empty($obj->debugAllUsersSocket) || (User::isAdmin() && !empty($obj->debugS
if (isset($_COOKIE['socketInfoPositionLeft'])) {
$socket_info_container_left = $_COOKIE['socketInfoPositionLeft'];
}
- $command = "sudo ulimit -n 1048576 && sudo nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &";
+ $command = "sudo ".YPTSocket::getStartServerCommand();
?>