Skip to main content

Thread: Bash Script Monitor and take action


hi

in process of writing bash script (which run on netbook) monitor status of ac power , take action if power changes battery power, namely suspend netbook. when netbook resumes script should start again, happy until ac power changes.

part troubles me how script keep running after has told netbook suspend. way have found far write second "inverse" script watches change ac power battery power, calls first script again, seems on top. how can combine 2 scripts in one?(i know on_ac_power it's not how make script "work", scripting , syntax)

script (in english)
code:
script 1  there ac power?  yes loop.  no run script 2 , suspend.  exit    script 2  there battery power?  yes loop. (we want suspend after loss of ac power)  no run script 1.  exit
also, should have script running time (so whilst ac power on keeps looping @ timed inteval) or "better" run cronjob?

quote posted jose catre-vandis view post
hi

in process of writing bash script (which run on netbook) monitor status of ac power , take action if power changes battery power, namely suspend netbook. when netbook resumes script should start again, happy until ac power changes.

part troubles me how script keep running after has told netbook suspend. way have found far write second "inverse" script watches change ac power battery power, calls first script again, seems on top. how can combine 2 scripts in one?(i know on_ac_power it's not how make script "work", scripting , syntax)

script (in english)
code:
script 1 there ac power? yes loop. no run script 2 , suspend. exit  script 2 there battery power? yes loop. (we want suspend after loss of ac power) no run script 1. exit
also, should have script running time (so whilst ac power on keeps looping @ timed inteval) or "better" run cronjob?
no need exit... run script time...

code:
if no power suspend. // suspended here, or not loop // script resumes there when computer resumes.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Bash Script Monitor and take action


Ubuntu

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account