tldr; When working with the raspberry pi and installation art, you may not always have a monitor. Use /etc/rc.local to start your script on boot, and edit /etc/innittab to remap ctrl alt del to shut down.
One thing that’s great about an arduino for interactive art is that you plug it in, it runs the script, and you can unplug it, and its fine.
The thing about the raspberry pi is that when you plug it in, it boots up and you’re prompted to log in. After you log in, you run the script you like. Finally at the end, you can’t unplug it. If you do, you risk damaging the SD card contents. So you have to safely shut down, and then unplug.
Here is a simple fix I found working on a piece right now, I admit, it’s a bit of a hack. The main constraint I had was that on location I wouldn’t have a monitor. So I had to figure out easy enough controls to deal with plugging the raspberry pi in, having it load the script, and then halting the pi before unplugging.
To start the script I added it to /etc/rc.local , before `exit 0`. Any commands in this file will be run at startup. When I plugging in the pi, I waited about one to two minutes, and then my script ran. I couldn’t ctrl-c (break) out of it. It has a webcam, if I unplugged that, the script would stop and I would be prompted in with the next step of startup- logging in. There is no way I could expect someone to log in without a monitor.
To turn it off, I edited the /etc/inittab file. I found where ctrl alt del is specified, and changed it from `shutdown -r` to `shutdown -h`. Instead of rebooting, ctrl alt del would shut down the pi safely.
I tested it out. While the script ran, I hit ctrl alt del. After a minute the script stopped, and then the pi powered down. When I needed to edit things on the pi, I just logged in through the network.
So there you go. Edit the rc.local file to start a script on boot, and remap ctrl alt delete to safely power down from anywhere.