Tag Archives: Exec format error

Shell script error: Exec format error [How to Solve]

Question:

The script reports an error as follows

Nov 29 18:18:58 db53 systemd: Failed at step EXEC spawning /etc/rc.d/init.d/realserver: Exec format error
Nov 29 18:18:58 db53 systemd: realserver.service: control process exited, code=exited status=203
Nov 29 18:18:58 db53 systemd: Failed to start (null).
Nov 29 18:18:58 db53 systemd: Unit realserver.service entered failed state.
Nov 29 18:18:58 db53 systemd: realserver.service failed.

Solution:

Add at the beginning

#!/bin/sh