1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

fix: 解决系统别名导致无法修改开机自启的问题 (#2849)

This commit is contained in:
ssongliu 2023-11-08 16:19:29 +08:00 committed by GitHub
parent e8ee373fc4
commit ac97d3c05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View File

@ -109,6 +109,12 @@ func (u *SSHService) OperateSSH(operation string) error {
}
stdout, err := cmd.Execf("%s systemctl %s %s", sudo, operation, serviceName)
if err != nil {
if strings.Contains(stdout, "alias name or linked unit file") {
stdout, err := cmd.Execf("%s systemctl %s ssh", sudo, operation)
if err != nil {
return fmt.Errorf("%s ssh(alias name or linked unit file) failed, stdout: %s, err: %v", operation, stdout, err)
}
}
return fmt.Errorf("%s %s failed, stdout: %s, err: %v", operation, serviceName, stdout, err)
}
return nil

View File

@ -86,7 +86,7 @@ const logSearch = reactive({
});
const handleClose = () => {
terminalSocket.value!.send('close conn');
terminalSocket.value?.send('close conn');
open.value = false;
};

View File

@ -155,7 +155,7 @@ const onClean = async () => {
};
onBeforeUnmount(() => {
terminalSocket.value!.send('close conn');
terminalSocket.value?.send('close conn');
});
defineExpose({

View File

@ -132,7 +132,7 @@ const loadTooltip = () => {
return i18n.global.t('commons.button.' + (screenfull.isFullscreen ? 'quitFullscreen' : 'fullscreen'));
};
const handleClose = async () => {
terminalSocket.value!.send('close conn');
terminalSocket.value?.send('close conn');
logVisible.value = false;
};
watch(logVisible, (val) => {