1 Replies - 350 Views - Last Post: 03 July 2013 - 02:42 PM Rate Topic: -----

#1 random0munky  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-July 13

Run Script on Wake

Posted 02 July 2013 - 11:00 AM

Hey guys trying to figure out the switch case for when a linux computer wakes/resumes from sleep. This is the bash script equivalent:

case $1 in
        echo "Hey guy, we are going to suspend to disk!"
        echo "Oh, this time we are doing a suspend to RAM. Cool!"
        echo "Oh, suspend to disk is over, we are resuming..."
        echo "Hey, the suspend to RAM seems to be over..."
    *)  echo "Somebody is calling me totally wrong."

I was seeing if this would work in my case (feeling it won't since python probably doesn't understand, hibernate, suspend, resume, thaw commands)

#!/usr/bin env python
switch($1) {
  case hibernate:
        print "Hibernate"
    case suspend:
        print "Suspend"
    case resume:
        print "Resume"
    case thaw:
        print "Thaw"

Is This A Good Question/Topic? 0
  • +

Replies To: Run Script on Wake

#2 Nallo  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 165
  • View blog
  • Posts: 258
  • Joined: 19-July 09

Re: Run Script on Wake

Posted 03 July 2013 - 02:42 PM

More importantly python doesn't have a switch statement. Don't throw bash code at python. It wont work.

Sorry for the rant.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1