Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SNMP "exec format error" when trying to run a script

Tags:

bash

snmp

I'm using SNMPD to run a script on a Raspberry Pi with net-snmp. I was able to get the same script running on my Slackware machine, but on the Pi, under extOutput.1, I'm getting "Exec format error".

The batch file being called is set to 777 and is:

#! /bin/bash
/sbin/reboot

Everything I've found about the error says that I would just need to include the #! at the beginning of the file and that would fix it, but it doesn't. I can run the script from the command prompt just fine, and /bin/bash obviously works also, but when called through SNMP (both snmpget and snmpwalk), the extOutput.1 line gives me that error.

like image 930
wolf2600 Avatar asked Nov 16 '13 20:11

wolf2600


1 Answers

Ugh. I had a blank line at the top of the script before the #! line.

like image 97
wolf2600 Avatar answered Nov 15 '22 06:11

wolf2600