View Single Post
Old 10-03-2013, 04:53 AM   #26
damaru
Enthusiast
damaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animals
 
damaru's Avatar
 
Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
I see that I could modify your code with (I am putting wrong code here, but I am looking for what I would replace it with if it exist):

Code:
 mkdir -p /mnt/us/scripts/startup /mnt/us/scripts/suspend /mnt/us/scripts/resume /mnt/us/script/unmount
        
   execute() {
     echo $1
    for file in /mnt/us/scripts/$1/*; do
      if [[ -f "$file" ]]; then
        echo "... $file"
        $file &
      fi
    done
  }    
       
  execute startup
       
  lipc-wait-event -m com.lab126.powerd goingToScreenSaver,outOfScreenSaver,usbunmount | while read event; do
    case "$event" in
      goingToScreenSaver*)
        execute suspend;;
      outOfScreenSaver*)
        execute resume;
        usbUnmount*)
        execute unmount;
   esac
  done;
damaru is offline   Reply With Quote