ガイドを使ってみました。ここで。 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
助けてください。
ありがとうございます。