{ config, lib, pkgs, ... }:
{
systemd.services.vmtest-2 = {
wantedBy = [ "multi-user.target" ];
#after = [ "network.target" ];
after = [ "display-manager.service" ];
description = " vmtest ";
serviceConfig = {
Type = "oneshot";
User = "yh";
ExecStart = ''
"/run/current-system/sw/bin/vmrun -T ws start /home/yh/vmware/OpenWrt-bypass/OpenWrt-bypass.vmx nogui"
'';
};
};
}
err log:
mtest-2.service - vmtest
Loaded: loaded (/etc/systemd/system/vmtest-2.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-03-22 18:39:21 CST; 258ms ago
Duration: 3ms
Process: 79459 ExecStart=/run/current-system/sw/bin/vmrun -T ws start /home/yh/vmware/OpenWrt-bypass/OpenWrt-bypass.vmx nogui (code=exited, status=203/EXEC)
Main PID: 79459 (code=exited, status=203/EXEC)
IP: 0B in, 0B out
CPU: 8ms
Mar 22 18:39:21 b150m systemd[1]: Starting vmtest...
Mar 22 18:39:21 b150m systemd[1]: vmtest-2.service: Main process exited, code=exited, status=203/EXEC
Mar 22 18:39:21 b150m systemd[1]: vmtest-2.service: Failed with result 'exit-code'.
Mar 22 18:39:21 b150m systemd[1]: Failed to start vmtest.
warning: error(s) occurred while switching to the new configuration
cat /etc/systemd/system/vmtest-2.service
[Unit]
After=display-manager.service
Description= vmtest
[Service]
Environment="LOCALE_ARCHIVE=/nix/store/3pd6pf95h3fsgq8w0wj4nv7s9fn98zyp-glibc-locales-2.38-44/lib/locale/locale-archive"
Environment="PATH=/nix/store/mb488rr560vq1xnl10hinnyfflcrd51n-coreutils-9.4/bin:/nix/store/rr5pqqck5f6fjkv7agwjyhaljvh27ncn-findutils-4.9.0/bin:/nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/bin:/nix/store/q7kq0naays5251ihghw0ccsz39id7kk5-gnused-4.9/bin:/nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/bin:/nix/store/mb488rr560vq1xnl10hinnyfflcrd51n-coreutils-9.4/sbin:/nix/store/rr5pqqck5f6fjkv7agwjyhaljvh27ncn-findutils-4.9.0/sbin:/nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/sbin:/nix/store/q7kq0naays5251ihghw0ccsz39id7kk5-gnused-4.9/sbin:/nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/sbin"
Environment="TZDIR=/nix/store/iq0aigzp8b381hzn3bp9yivpm2hgg25p-tzdata-2024a/share/zoneinfo"
ExecStart="/run/current-system/sw/bin/vmrun -T ws start /home/yh/vmware/OpenWrt-bypass/OpenWrt-bypass.vmx nogui"
Type=oneshot
User=yh
[Install]
WantedBy=multi-user.target