尝试 运行 服务时出现 systemctl Exec 格式错误
systemctl Exec format error when trying to run service
目前我想 运行 我的专用服务器在我的 vps 上。当我 运行 系统 systemctl start csgo.service
它给我错误 Load: error (Reason: Exec format error)
当我 运行 systemctl status csgo.service
它给我 /lib/systemd/system/csgo.service:12: Executable path is not absolute: killall -TERM srcds_linux
。下面是我正在尝试 运行 的服务文件,我是不是犯了什么错误,因为它说格式错误?
[Unit]
Description=CSGO Server
[Service]
Type=simple
User=steam
Group=steam
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
ExecStart=/home/steam/steamcmd/csgo/srcds_run -game csgo -console -usercon +game_type 0 +game_mode 1 -tickrate 128 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount GsltKeyHere -net_port_try 1
ExecStop=killall -TERM srcds_linux
[Install]
WantedBy=multi-user.target
我的专用服务器文件在里面 /home/steam/steamcmd/csgo
Note that shell command lines are not directly supported. If shell command lines are to be used, they need to be passed explicitly to a shell implementation of some kind.
Example: ExecStart=sh -c 'dmesg | tac'
您需要像那样使用 sh
或找出 killall
可执行文件的实际路径,例如
[Unit]
ExecStop=sh -c 'killall -TERM srcds_linux'
或
[Unit]
ExecStop=/sbin/killall -TERM srcds_linux
顺便说一句,这不是 ExecStop
命令中最好的;它会无情地杀死 all srcds_linux
可执行文件,无论它们是否与此服务相关。没有 ExecStop
命令将让 systemd 自行终止服务:
Note that it is usually not sufficient to specify a command for this setting that only asks the service to terminate (for example, by queuing some form of termination signal for it), but does not wait for it to do so. Since the remaining processes of the services are killed according to KillMode= and KillSignal= as described above immediately after the command exited, this may not result in a clean stop. The specified command should hence be a synchronous operation, not an asynchronous one.
目前我想 运行 我的专用服务器在我的 vps 上。当我 运行 系统 systemctl start csgo.service
它给我错误 Load: error (Reason: Exec format error)
当我 运行 systemctl status csgo.service
它给我 /lib/systemd/system/csgo.service:12: Executable path is not absolute: killall -TERM srcds_linux
。下面是我正在尝试 运行 的服务文件,我是不是犯了什么错误,因为它说格式错误?
[Unit]
Description=CSGO Server
[Service]
Type=simple
User=steam
Group=steam
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
ExecStart=/home/steam/steamcmd/csgo/srcds_run -game csgo -console -usercon +game_type 0 +game_mode 1 -tickrate 128 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount GsltKeyHere -net_port_try 1
ExecStop=killall -TERM srcds_linux
[Install]
WantedBy=multi-user.target
我的专用服务器文件在里面 /home/steam/steamcmd/csgo
Note that shell command lines are not directly supported. If shell command lines are to be used, they need to be passed explicitly to a shell implementation of some kind.
Example:
ExecStart=sh -c 'dmesg | tac'
您需要像那样使用 sh
或找出 killall
可执行文件的实际路径,例如
[Unit]
ExecStop=sh -c 'killall -TERM srcds_linux'
或
[Unit]
ExecStop=/sbin/killall -TERM srcds_linux
顺便说一句,这不是 ExecStop
命令中最好的;它会无情地杀死 all srcds_linux
可执行文件,无论它们是否与此服务相关。没有 ExecStop
命令将让 systemd 自行终止服务:
Note that it is usually not sufficient to specify a command for this setting that only asks the service to terminate (for example, by queuing some form of termination signal for it), but does not wait for it to do so. Since the remaining processes of the services are killed according to KillMode= and KillSignal= as described above immediately after the command exited, this may not result in a clean stop. The specified command should hence be a synchronous operation, not an asynchronous one.