September-16th-2020, 11:33 AM
(This post was last modified: September-16th-2020, 11:56 AM by Armin@netPI.)
Well usually a container can't shutdown a system at all. But there are two methods I see.
1. A hard way is to shutdown using this command in a container
2. A more smoothen way is to access the netPI web UI over its REST API. I described it here https://forum.hilscher.com/thread-317.ht...hlight=API a while ago with some sample codings. So basically all the manual mouse triggered function you do usually in your web browser you can do also automated like login, watch pages, trigger functions.
For a test with Linux install http command first with
Then login to your netPI using your admin password instead of <your admin password> and note down the <session-ID> received back in the response
Then call the shutdown command and wait for 10 seconds and the shutdown will start to proceed.
Thx
Armin
1. A hard way is to shutdown using this command in a container
Code:
echo 1 >/proc/sys/kernel/sysrq && echo s > /proc/sysrq-trigger && sleep 10 && echo b > /proc/sysrq-trigger
2. A more smoothen way is to access the netPI web UI over its REST API. I described it here https://forum.hilscher.com/thread-317.ht...hlight=API a while ago with some sample codings. So basically all the manual mouse triggered function you do usually in your web browser you can do also automated like login, watch pages, trigger functions.
For a test with Linux install http command first with
Code:
apt-get install httpie
Then login to your netPI using your admin password instead of <your admin password> and note down the <session-ID> received back in the response
Code:
http --verify=no --json POST "https://<netPI IP address>/login" username=admin password=<your admin password>
Then call the shutdown command and wait for 10 seconds and the shutdown will start to proceed.
Code:
http --verify=no --json POST "https://<netPI IP address>/system" 'Cookie:<session-ID>' 'argument=shutdown'
Thx
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)