GideonTech.com Forums

  • July 20, 2017, 09:38:35 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Pages: [1]   Go Down

Author Topic: Anyone good with console? Trying to install something.  (Read 4067 times)

pHEnomIC69

  • Senior Modder
  • ***
  • Karma: +0/-1
  • Offline Offline
  • Posts: 674
Anyone good with console? Trying to install something.
« on: July 23, 2011, 03:22:11 PM »

Basically all i need it to do at this point is unmount /Volumes/Backup at sleep. I found a program called sleep watcher and it should do what i need. This is on OSX.

I followed the directions:
$ sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8
$ sudo cp ~/Desktop/sleepwatcher_2.1.1/sleepwatcher /usr/local/sbin
$ sudo cp ~/Desktop/sleepwatcher_2.1.1/sleepwatcher.8 /usr/local/share/man/man8

with no issues. 

Then I made a file called .sleep which has:
#!/bin/sh
/usr/sbin/diskutil eject '/Volumes/Backup/'

I also did chmod a+x .sleep


I then run:
/usr/local/sbin/sleepwatcher --verbose --sleep .sleep

and I get: -bash: /usr/local/sbin/sleepwatcher: Not a directory

I also tried installing it into /sbin like so:
$ sudo cp ~/Desktop/sleepwatcher_2.1.1/sleepwatcher /sbin

I then try: /sbin/sleepwatcher --verbose --sleep .sleep

But then I get:
sh: .sleep: command not found
sleepwatcher: sleep: .sleep: 32512


Any advice on this?
Its supposed to monitor for sleep and then run the script, but I have no idea.
Logged

~Link~

  • Senior Modder
  • ***
  • Karma: +9/-1
  • Offline Offline
  • Posts: 714
    • Project 365
Re: Anyone good with console? Trying to install something.
« Reply #1 on: July 23, 2011, 05:53:30 PM »

Haven't messed with OSX from the command line a lot, but my Linux senses are saying that you'll need to install your .sleep script as well.

Move your .sleep script into /usr/bin, and that should take care of your latest error message.  If you can run the .sleep script by just typing ".sleep" into a console, you should be home free.
I believe sbin is traditionally supposed to be used for commands run by the system.

Logged
1 photo per day, for 1 year.  http://checkonetwo.ca

pHEnomIC69

  • Senior Modder
  • ***
  • Karma: +0/-1
  • Offline Offline
  • Posts: 674
Re: Anyone good with console? Trying to install something.
« Reply #2 on: July 24, 2011, 03:22:50 AM »

perfect! that did the trick!

Now i just gotta figured out how to use launchd or something to fire up the sleepwatcher at startup but ill worry about that tomorrow.
Logged

GideonX

  • Administrator
  • Elite Modder
  • *****
  • Karma: +93/-5
  • Offline Offline
  • Posts: 9,460
    • GideonTech.com
Re: Anyone good with console? Trying to install something.
« Reply #3 on: July 24, 2011, 02:00:22 PM »

You can also just use the full path to .sleep, no need to move that into /bin or /sbin :)

/usr/local/sbin/sleepwatcher --verbose --sleep /full/path/to/.sleep
Logged

GTF Gallery
4 8 15 16 23 42
Pages: [1]   Go Up
 

Page created in 0.055 seconds with 18 queries.