Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bootstrap shell script that is run as the very first thing when a fresh Linux server is booted up to multi-user mode with networking.

Once it is complete, I would like to report the error status to a central loghost server, which is currently running syslog-ng with udp/tcp port 514 and a webserver on port 80 (hence I could use php/perl to listen to http formatted messages...)

However I can't install any packages, as the build is specified by the customer, and also I would like to not make any changes to the config files. Hence the syslog is pristine, and possibly wget/curl are not installed.

I was going to do something like;

exec 3<>/dev/tcp/www.google.com/80
echo -e “GET / HTTP/1.1\nhost: http://loghost.local/message\n\n” >&3

but it turns out these devices are disabled on debian boxes.

I can obviously cascade the different options, eg;

if [ -x wget ]; then
  echo "using wget to post message"
elif [ -x curl ]; then
  echo "using curl to post message"
elif [  ]; then
  exec 3<>/dev/tcp/loghost.local/80
  echo -e “GET / HTTP/1.1\nhost: http://loghost.local/message\n\n” >&3
  echo nc ## some netcat command so send stuff to udp 514...

logger looks like it only supports local and socket connections, and would presumably suffer from the debian restriction

I appear to have many options, as I can configure many things on the service. one such very silly idea was to configure the local nameserver to cache missing records for certain domains, and have the bootstrap script run something like

getent hosts logmessage.sourceserver.mydomain.com

and presumably, I could parse the status from the named log file.... ;-)

obviously netcat is an option if it is installed, however some of the server builds aggressively remove stuff like netcat because it is so flexible.

Anyway, this problem is more for informational interest rather than practical purposes, because I can swap the syslog.conf file out temporarily, but it would be interesting to do it with no touching on the remove server...

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.