Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 6025|Reply: 7

Use power button to shutdown

[Copy link]

3

Threads

10

Posts

62

Credits

Registered member

Rank: 2

Credits
62
QQ
Post time 2016-7-30 04:02:45 | Show all posts |Read mode
Power Button on orange pi with armbian OS seems to be useless and doesn't do anything.
here is the guide to use it as shutdown button ! so when you pushed it your orange pi would shutdown.

1- first login to root user or use sudo before all commands.
  1. su
Copy the Code
2- update your repos
  1. apt-get update
Copy the Code
3- install acpid
  1. aptitude install acpid
Copy the Code
4- make a new file for power button event in acpi app
  1. nano /etc/acpi/events/button_power
Copy the Code
5- paste this codes
  1. event=button/power
  2. action=/sbin/shutdown -h now
Copy the Code
6- Press Ctrl + X and then press Y
7- Make your code executable
  1. chmod +x /etc/acpi/shutdown.sh
Copy the Code
8- Restart acpi app
  1. /etc/init.d/acpid restart
Copy the Code
9- Done! Now press the power button on your device to shutdown your device !
You can also edit button_power file to do anything you want when pressing the power button.
Enjoy.







www.m3ni.com [url=http://www.orangepi.org/orang

7

Threads

129

Posts

851

Credits

Senior member

Rank: 4

Credits
851
Post time 2016-7-30 05:10:58 | Show all posts
Edited by nopnop2002 at 2016-7-30 09:02

Thank you very much for your useful information.
I don't found /etc/acpi/shutdown.sh in my OPI-ONE.
Is this necessary?
chmod +x /etc/acpi/shutdown.sh


3

Threads

10

Posts

62

Credits

Registered member

Rank: 2

Credits
62
QQ
 Author| Post time 2016-7-30 18:33:27 From the mobile phone | Show all posts
There is no /etc/acpi/shutdown.sh , you should make that file and paste the codes in step 5 in it, also chmod +x is necessary so it could be executable.

7

Threads

129

Posts

851

Credits

Senior member

Rank: 4

Credits
851
Post time 2016-7-30 19:54:05 | Show all posts
M3NI replied at 2016-7-30 18:33
There is no /etc/acpi/shutdown.sh , you should make that file and paste the codes in step 5 in it, a ...

In the following which file should I paste?
/etc/acpi/events/button_power
/etc/acpi/shutdown.sh


3

Threads

10

Posts

62

Credits

Registered member

Rank: 2

Credits
62
QQ
 Author| Post time 2016-7-31 02:56:48 From the mobile phone | Show all posts
Both of those lines and you should add "-h now" after shutdown.sh without this it wont work well, this command tells the shutdown.sh to put the system in halt state, now. Then after halt process got completed and partitions got unmounted system will be ready to get powered off (by pulling it out of power, or unpluging it)

1

Threads

14

Posts

143

Credits

Registered member

Rank: 2

Credits
143
Post time 2016-11-7 02:09:13 | Show all posts
There is no need to create/chown the /etc/acpi/shutdown.sh file, as /etc/acpi/events/button_power calls /sbin/shutdown -h now directly

7

Threads

129

Posts

851

Credits

Senior member

Rank: 4

Credits
851
Post time 2016-11-7 21:24:06 | Show all posts
The_Loko replied at 2016-11-7 02:09
There is no need to create/chown the /etc/acpi/shutdown.sh file, as /etc/acpi/events/button_power ca ...


I confirmed that no need to create/chown the /etc/acpi/shutdown.sh file.



0

Threads

3

Posts

16

Credits

Novice

Rank: 1

Credits
16
Post time 2017-4-7 11:28:24 | Show all posts
Edited by bcruzligsanan at 2017-4-7 13:18

Sir it doesnt work for me.. I have my Orange Pi Plus 2 with Debian Jessie.. Please Help..
Do i have to load the modules for acpi?

You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2017-5-23 03:30 GMT+8 , Processed in 0.031266 second(s), 23 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list