這個隨便google一下就找的到答案了吧https://askubuntu.com/questions/637349/how-to-make-a-bash-script-execute-when-the-battery-on-my-laptop-begins-charging