如前面的两个例子,在执行systemctl时经常出现问题
例如
[root@z system]# systemctl status changeconfig.service -l
changeconfig.service - NIC Saver
Loaded: loaded (/usr/lib/systemd/system/changeconfig.service; enabled)
Active: failed (Result: exit-code) since Mon 2016-10-10 05:11:51 EDT; 1min 5s ago
Process: 10949 ExecStart=/usr/bin/changename (code=exited, status=203/EXEC)
Main PID: 10949 (code=exited, status=203/EXEC)
Oct 10 05:11:51 z.cent7 systemd[1]: Starting NIC Saver...
Oct 10 05:11:51 z.cent7 systemd[1]: changeconfig.service: main process exited, code=exited, status=203/EXEC
Oct 10 05:11:51 z.cent7 systemd[1]: Failed to start NIC Saver.
Oct 10 05:11:51 z.cent7 systemd[1]: Unit changeconfig.service entered failed state.
处理方法:
/usr/bin/changename发现前面忘记加如下语句
#!/bin/sh
原因:systemctl执行脚本需要确认其解释器