1

I have a raspberry pi and run dosbox from the command line. Is it possible to write a script to run dosbox and shutdown Linux "sudo halt" after i have exited dosbox.

something like

#!/bin/bash
#run dosbox 
dosbox
#after exiting dosbox shutdown Linux
sudo halt
exit 0 
3

The code

echo "sudo shutdown -h now" | /usr/bin/at now + 10 min >/dev/null 2>&1
exit 0

will give the instruction to shut down the Pi (inserting a suitable delay) and exit the script cleanly. Here we have redirected the output to make it 'silent'.

  • sudo shutdown -h +10 wold have the same effect without calling at. I'm pretty sure that the OP wanted the Raspberry Pi to shutdown cleanly as soon as dosbox had finished, though. – scruss Jan 19 '14 at 16:41
  • I want the script detect when dosbox has closed then halt linux – user3211887 Jan 19 '14 at 20:00
  • I think your original script will? It just wouldn't exit your script cleanly, whereas a small delay would. – mirams Jan 24 '14 at 21:55
  • If there's nothing else for the script to do, there's no need to exit it "cleanly". – TomG Apr 19 '14 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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