3

guys,i have a problem on using xinetd,the error message is 'xinetd[20126]: execv( /home/fulu/download/mysqlchk_status2.sh ) failed: Exec format error (errno = 8)'

  1. the system operation is : CentOS release 6.2;
  2. i installed the xinetd by the command 'sudo yum install xinetd'
  3. i edited the /etc/services, add my port 6033 for my service named 'mysqlchk'
  4. the service 'mysqlchk' in /etc/xinetd.d/mysqlchk is

    service mysqlchk { disable = no flags = REUSE socket_type = stream port = 6033 wait = no user = fulu server = /home/fulu/download/mysqlchk_status2.sh log_on_failure += USERID }

  5. the shell file /home/fulu/download/mysqlchk_status2.sh content is

    echo 'test'

6.i can run the command /home/fulu/download/mysqlchk_status2.sh straightly and get the result 'test'

  1. when i telnet 127.0.0.1 6033,i get the output

    Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Connection closed by foreign host.

then i tail the log file /var/log/messages,it shows

Apr 22 22:01:47 AY1304111122016 xinetd[20001]: START: mysqlchk pid=20126 from=127.0.0.1
Apr 22 22:01:47 AY1304111122016 xinetd[20126]: execv( /home/fulu/download/mysqlchk_status2.sh ) failed: Exec format error (errno = 8)
Apr 22 22:01:47 AY1304111122016 xinetd[20001]: EXIT: mysqlchk status=0 pid=20126 duration=0(sec)

i don't know why,can anybody help me ?

1 Answers1

2

I'm sorry, after questioning it i suddenly found the answer. If you want the shell to be run in other program you need add '#!/bin/echo' at the first line of the shell file (of course the echo can be changed)

alexs333
  • 12,143
  • 11
  • 51
  • 89