0

I have written a very simple bash-code which is trying to send the local hostname of the system to a php-page, basically using: curl mypage.com/?hostname=$HOSTNAME

When I run this bash file "per hand", it is perfectly working. However, when started by rc.local, it does execute, but the hostname is working - the page only receives a request, but without the GET-value. (i.e. ?hostname= )

I have tried adding "export HOSTNAME" before the curl-command, but it still does not work.

Does any of you have an idea why this is happening?

My system is Raspbian, and the php-page works.

Thanks :D

1 Answer 1

0

It seems that /bin/sh is not a symlink to bash on your system. Use

curl mypage.com/?hostname=$(hostname)
1
  • Thanks for the quick answer. Also, it seems that I have to use the full path for curl. (thus /usr/bin/curl)
    – Domack
    Oct 5, 2015 at 12:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .