需要帮助在启动时运行进程

需要帮助在启动时运行进程

尝试过的指南来自这里。 使用 nano 编辑此文件:/etc/systemd/system/myservice.service。

.service 文件是:

[Unit]
Description=DOESN'T WORK.

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/home/otsmanager/NOSTWINDOWS2/script.sh
[Install]
WantedBy=multi-user.target

我在控制台中得到以下输出:

root@167-114-137-36:/home/otsmanager/NOSTWINDOWS2# sudo systemctl status myservice
● myservice.service - DOESN'T WORK.
     Loaded: loaded (/etc/systemd/system/myservice.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sat 2021-06-19 20:26:13 CEST; 6min ago
    Process: 12951 ExecStart=/home/otsmanager/NOSTWINDOWS2/script.sh (code=exited, status=0/SUCCESS)
   Main PID: 12951 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4915)
     Memory: 2.7M
     CGroup: /system.slice/myservice.service

Jun 19 20:26:13 167-114-137-36 script.sh[12990]: directories currently searched are:
Jun 19 20:26:13 167-114-137-36 script.sh[12990]: - /root/.local/share
Jun 19 20:26:13 167-114-137-36 script.sh[12990]: - /usr/local/share/
Jun 19 20:26:13 167-114-137-36 script.sh[12990]: - /usr/share/
Jun 19 20:26:13 167-114-137-36 script.sh[12954]: 002a:err:module:import_dll Library VCRUNTIME140_1.dll (which is needed by L"Z:\\home\\otsmanager\\NOSTWIN>
Jun 19 20:26:13 167-114-137-36 script.sh[12954]: 002a:err:module:import_dll Library mpir.dll (which is needed by L"Z:\\home\\otsmanager\\NOSTWINDOWS2\\the>
Jun 19 20:26:13 167-114-137-36 script.sh[12954]: 002a:err:module:import_dll Library VCRUNTIME140_1.dll (which is needed by L"Z:\\home\\otsmanager\\NOSTWIN>
Jun 19 20:26:13 167-114-137-36 script.sh[12954]: 002a:err:module:import_dll Library pugixml.dll (which is needed by L"Z:\\home\\otsmanager\\NOSTWINDOWS2\\>
Jun 19 20:26:13 167-114-137-36 script.sh[12954]: 002a:err:module:LdrInitializeThunk Importing dlls for L"Z:\\home\\otsmanager\\NOSTWINDOWS2\\theforgottens>
Jun 19 20:26:13 167-114-137-36 sudo[12953]: pam_unix(sudo:session): session closed for user root

请帮忙。

谢谢。

相关内容