View: 40170|Reply: 7

Use power button to shutdown

[Copy link]

3

threads

10

posts

62

credits

Registered member

Rank: 2

credits
62
QQ
Published in 2016-7-30 04:02:45 | Show all floors |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 code
2- update your repos
  1. apt-get update
Copy code
3- install acpid
  1. aptitude install acpid
Copy code
4- make a new file for power button event in acpi app
  1. nano /etc/acpi/events/button_power
Copy code
5- paste this codes
  1. event=button/power
  2. action=/sbin/shutdown -h now
Copy code
6- Press Ctrl + X and then press Y
7- Make your code executable
  1. chmod +x /etc/acpi/shutdown.sh
Copy code
8- Restart acpi app
  1. /etc/init.d/acpid restart
Copy 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

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-7-30 05:10:58 | Show all floors
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| Published in 2016-7-30 18:33:27 from mobile | Show all floors
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.

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-7-30 19:54:05 | Show all floors
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| Published in 2016-7-31 02:56:48 from mobile | Show all floors
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
Published in 2016-11-7 02:09:13 | Show all floors
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

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-11-7 21:24:06 | Show all floors
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

24

credits

Novice

Rank: 1

credits
24
Published in 2017-4-7 11:28:24 | Show all floors
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 need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list