I’d like for my droplet image to do the following:
poweroff
I haven’t been able to make this work. The poweroff
command works from the CLI, if I am logged in as a user, even if the user is not a sudoer.
But if noone is logged onto the CLI, and the task finishes without a user being logged into the shell, the poweroff
command appears to have no effect.
How do I power off a droplet programmatically from a bash script?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
The following at first seemed to enable
poweroff
from userland:sudo chmod a+s /usr/sbin/poweroff
… However I was not able to reliably make this work without a logged in shell user present.
What I’m doing now, instead, is: