I use my Raspberry Pi Model B with Raspbian as a server and I want to know (if it is possible) how to make that the Raspberry pi send itself a halt command when I unplug the Ethernet cable (eth0)
Any help will be very appreciated.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
Write a script to call 'reboot' as /path/to/script.sh
Edit your /etc/network/interfaces file and add a line just below your eth0 config.
auto eth0 iface eth0 inet static name "Ethernet0" address 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.254 post-down /path/to/script.sh
Your /path/to/script.sh script will run when your eth0 down.