linux install service, stop service before start (#8414)

If the stop-service option before installation is "", after
installation --sever is also started up. When clicking to
start service, restart --server to make it read the config file,
otherwise the service can't be started util --server is restarted.

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-06-19 16:29:40 +08:00 committed by GitHub
parent 99edab4b61
commit 7c45a68870
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1392,7 +1392,7 @@ pub fn install_service() -> bool {
let cp = switch_service(false);
let app_name = crate::get_app_name().to_lowercase();
if !run_cmds_pkexec(&format!(
"{cp} systemctl enable {app_name}; systemctl start {app_name};"
"{cp} systemctl enable {app_name}; systemctl stop {app_name}; systemctl start {app_name};"
)) {
Config::set_option("stop-service".into(), "Y".into());
return true;