I have many raspberries located in different places. All of them are connected to my website and download videos to show on their respective monitors.

Is it possible to send some command from my website (i use php language) to reboot the raspberry remotely? That is to say, run a command from my server to reboot a raspberry pi?

My raspberries are connected to an access point which is connected to the internet, but it does not have static IP.

This guide here presumes the raspberry and the server machine are in the same network, but for my setup that is not true.

Any solution to restart the raspberry remotely (through internet) would be helpful.

3 Answers 3


On your webserver you can setup a specific file to hold a command, for example


That file should hold a sequence number and a command.

Periodically (research crontab) the Raspberry Pis should download that page, check the sequence number against their saved sequence number of the latest command they run, check the command against a list of valid commands, and if so, execute the command and save the sequence number for future reference.

Then all you have to do is create the file command-for-raspberry.txt with, for example, the content

01  reboot now

put it on the server and wait for the Pis to download and execute it.

NOTE: there is no security built into this solution, and it can be easily exploited in a multitude of ways.

  • Actually i really started a solution close to your solution.... i create a python script listener.py in my raspberry... it always send a request to a simple web Service in my server... which will give it the command to execute ... for security my python always send a API Key and my web service also check this key ... but i will consider you answer is the best and the correct one ... thank you Commented Jun 11, 2015 at 12:10

You can install and run piControl, a Node.js web application to shut down or reboot your Raspberry Pi.

More info here.

To make your Raspberry Pi reachable from the Internet, you should give it a static IP address on your local network, and forward the public HTTP default port (80) to the local IP address of the Raspberry Pi.

  • i like piControl but they said "piControl is allow reboot and shutdown from browser in local network" so it is for local network ,,, and you said i must give the pi a static IP ... so how Teamviewer can connect to other PC in windows without static IP ??? Commented Jun 11, 2015 at 10:55
  • TeamViewer (TV) is a little special: you don't need your RPi to have a static IP address since when you connect to it, you don't really make a direct connexion from your computer to your RPi. When you run TV on your RPi, the RPi connects to the TV' servers, and waits a incoming connection. Then, when you connect to your RPi from your computer (or tablet, or whatever), your computer will, in fact, connect to the TV' servers, will find your RPi's ID number given by the TV running on your RPi, and take control of your RPi. Besides, you don't need to run TV on the RPi to run piControl. Commented Jun 11, 2015 at 11:07

From a remote machine, assuming you have a ssh server running on the Pi.

ssh root@raspberrypi reboot


ssh pi@raspberrypi sudo reboot

  • my raspberry does not has static ip,, it is connected to "access point" in a local network and this "access point" is connected to the internet ,,, so how my remote server can access to raspberry and run this command ... it need first to open ssh session ,,, but without host(ip) you can not open this session Commented Jun 11, 2015 at 9:58
  • Are they connected to the internet or not? Do they have a public IP address? It does not matter if it is static or dynamic.
    – joan
    Commented Jun 11, 2015 at 11:05
  • The question is specifically about how to "send some command from my website".
    – Bex
    Commented Jan 22, 2016 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.