How to automatically shut down tablet after it auto-powers on? Currently my tablet on Android 4.0.4 (rooted) sometimes switches on by accident, which I don't want. (I'm cycling through Africa and sometimes power connections are minimal.) I need a way to shutdown the tablet after starting up. So something like:


Start on boot
After X (say, 10) minutes, prompt me to continue with a "Yes" button (in case I use it)
If I select "No", shuts down and completely powers off the tablet. 


I tried several apps but cannot find a solution. Any suggestions?
You can use Tasker (paid; 7 day free trial) and its Scenes to achieve the goal.

Example: 

(Click image to enlarge)





Instructions

(Note: root access is needed to shutdown the device.)


Go to Tasker &rarr; Scenes and create a scene named Auto off.
Per your taste, set the size of the scene. 

You can add text using Text element. The Yes and No in the images are also text elements but you can opt for button elements too.
Similarly, create a separate scene for Yes and No options named Yes and No. 

While you've not asked for confirmation, I've considered Andrew T.'s point legit and genuine, hence, separate confirmation for Yes and No selection would do good.
I'm giving a broad idea here. 


For each element of scene, under Tap there is an option to execute an action when the element is tapped once. 
Show scene and Destroy scene options are available under Scenes action category. 
For any Show scene, set Display As: Overlay Blocking and uncheck Show Exit button -- this would force you to choose an option in a scene and avoids the scene getting closed by a hardware button, such as Back button.
Wherever you want to show the timer, mention %Scount.
Auto off scene, 


for the Yes element, destroy Auto off scene and show Yes scene
for the No element, destroy Auto off scene and show Yes scene

Yes scene, 


for Yo man! element, destroy Yes scene and do Task &rarr; Stop &rarr; Auto power off 
for Shutdown now element, select System → Reboot → Type: Shutdown 

No scene,


for Just do it! element, select System → Reboot → Type: Shutdown
for Hell no!! element, destroy No scene and do Task &rarr; Stop &rarr; Auto power off 


Profile, task and actions:


Profile: Event &rarr; System &rarr; Device Boot
Task: (Name: Auto power off): (Actions):


Task &rarr; Wait &rarr; set Wait as the time period after which you want to seek user intervention to continue or shutdown
Scene &rarr; Show Scene &rarr; select your first scene (Auto off)
Variables &rarr; Variable Set &rarr; Name: %Scount, To: set 60 or maximum number of seconds for auto shutdown timer
Task &rarr; Wait &rarr; 1 minute
Variables &rarr; Variable Subtract &rarr; Name: %Scount, Value: 1
Task &rarr; GoTo:


Type: Action Number
Number: 4
If %Scount &gt; 0

System &rarr; Reboot &rarr; Type: Shutdown  






Supplementary info:


%Scount is your custom global variable which should be equal to the maximum value of auto shutdown timer, such as 60 for 1 minute or 60 seconds.
In the task Auto power off, the variable gets set to maximum value of timer after the first X minutes wait is over and first scene is shown. This is what starts the timer.
For timer to work, Tasker waits for one second, then subtracts value 1  from the current value of %Scount, decides to wait for one second  and do the subtraction again, if the variable's value is not zero, and once the values reaches zero device executes the shutdown action. (I learned about the timer from the post by nooblikeyou here.)
In the Yes and No scene, the task Auto power off is supposed to be stopped wherever you choose to continue using the device, else, once the timer completes the device will auto shutdown.
The solution would work even if the screen is off.