Hello Joe, Thanks for the information. I will take a careful look at it, but for the moment don't promise anything. Changing APIs from one version to another is *very* annoying. It makes programming harder. Hopefully they will stabilize it in 10.7.
Best regards, Kern On 01/30/2014 03:34 PM, Joe Rhodes wrote: > Kern: > > I no very little about programming, but here’s the documentation for creating > and releasing a power assertion on OS X. There is a call > “IOPMAssertionCreate” which is available in 10.5, then deprecated in 10.6. > Seems it was replaced with “IOPMAssertionCreateWithDescription” which came in > 10.7. > > > https://developer.apple.com/library/mac/documentation/IOKit/Reference/IOPMLib_header_reference/Reference/reference.html#//apple_ref/doc/uid/TP40012430 > > > I don’t know if that will help any or not. It would be pretty awesome to see > in Bacula. Love that Windows will be getting that feature built in! > > Cheers! > -Joe > > >> Hello, >> >> The next Windows version to be released by Bacula Systems roughly in >> June -- it will >> be version 8.0 tells the Windows OS not to suspend the SD during a job. >> >> For OSX, I don't know if an OS API exists to do this -- on Linux, it >> doesn't seem >> to have one, which means that it is not so simple. If anyone has some >> simple >> OS API call for Linux or Mac OSX that will do this, please let me know. >> >> Best regards, >> Kern >> >> On 01/27/2014 04:50 PM, Josh Fisher wrote: >>> On 1/21/2014 6:25 PM, Joe Rhodes wrote: >>>> Sorry, turns out there was an error in my previous suggestion and >>>> ?caffeinate? was not actually started on the client. Here?s an updated >>>> (and tested) line that does keep a 10.8 or later mac awake for 3600 >>>> seconds: >>>> >>>> Client Run Before Job = "bash -c \"/usr/bin/caffeinate -i -t 3600 &> >>>> /dev/null < /dev/null &\"" >>>> >>>> >>>> Turns out, getting a command into the background using the ?Client Run >>>> Before Job? was more tricky than I realized. This command does the trick. >>>> You?ll have to adjust the time (3600) to suit your needs. (I?ve got one >>>> client that takes 4 hours to do a full backup.) >>>> >>>> It also does not fail the job if the ?caffeinate? command cannot be found >>>> (10.7 or earlier clients). So it should be safe to use that command for >>>> any OS X client. >>>> >>>> >>>> Josh Fisher asked: >>>> >>>>> I take there simply is no way to prevent sleep on 10.7 and earlier? >>>> With 10.7 and earlier, things were actually simpler. You just set the >>>> sleep timer in System Preferences (or using pmset from the command line) >>>> and the Mac would stay awake for whatever you had it set for, even from a >>>> WOL packet. I?d typically set it for 2 hours on most machines. I only >>>> started to get lots of failed jobs with 10.8 and later. Thats? where >>>> Apple got a lot more aggressive about power management. >>> I see. With 10.7 and earlier there is no way to "temporarily" adjust the >>> sleep timer. If a permanent long sleep timer is not desired, then it >>> would require the RunBefore script to set the sleep timer with pmset and >>> a RunAfter job to set it back to normal following the backup. My Mac >>> clients are in and out of the office seemingly at random. It is not >>> uncommon for the users to leave in the middle of a backup. Up grading to >>> 10.8 and using caffeinate seems to be my best option, else they will be >>> left with a long sleep timer while traveling should they leave in the >>> middle of a backup. It is a real pain trying to backup these "road >>> warrior" clients. >>> >>>>> You wouldn't happen to know how to enable WoWLAN on a Mac would you? >>>> Again, easily set in System Preferences or using pmset from the command >>>> line. If you?ve got a lot of Macs, Apple Remote Desktop is your friend >>>> here. (?Send Unix Command? to the whole fleet) >>> Thanks, Joe. >>> >>>> Cheers! >>>> -Joe Rhodes >>>> >>>> >>>>> For those that are backing up OS X clients, you may have noticed that >>>>> 10.8 Mountain Lion and later is much more militant about having machines >>>>> sleep. Even if you issue a WOL packet to start a backup, they still fall >>>>> back asleep pretty quickly unless there?s someone actually using the >>>>> mouse and keyboard. It doesn?t really matter what you have the sleep >>>>> timer set to. >>>>> >>>>> Apple?s strategy seems to be that programs that need to run must issue a >>>>> ?power assertion? to the system, indicating that the system must stay >>>>> awake for them complete their task. Fortunately, it?s easy enough to >>>>> issue one of these manually using the command line. >>>>> >>>>> In my job definition (in the Bacula director configuration) I?ve added >>>>> this line to my Mac clients: >>>>> >>>>> Client Run Before Job = "/usr/bin/screen -d -m /usr/bin/caffeinate -i -t >>>>> 3600; sleep 0;? >>>>> >>>>> The first part, using the ?screen? command, puts the command in the >>>>> background. The ?caffeinate? command is new for 10.8 and later, and will >>>>> keep the system awake for 3600 seconds. (Edit to suit your needs.) >>>>> >>>>> If you?re backing up 10.7 or earlier systems, they won?t have the >>>>> caffeinate command, so trying to issue it will fail and thus your backup >>>>> would fail. That?s why there?s the ?sleep 0? part at the end. It >>>>> ensures you?ll always exit this command with a success (0). >>>>> >>>>> Hopefully this will help someone else that gets stuck when a Mac backup >>>>> starts but then fails, usually taking about 2 hours before the director >>>>> will give up and move on. >>>>> >>>>> Windows 7 seems to have a similar issue. I was able to solve that by >>>>> editing a registry value as below: >>>>> >>>>> >>>>> [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0\DefaultPowerSchemeValues\381b4222-f694-41f0-9685-ff5bb260df2e] >>>>> "AcSettingIndex"=dword:00000e10 >>>>> >>>>> [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0\DefaultPowerSchemeValues\8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c] >>>>> "AcSettingIndex"=dword:00000e10 >>>>> >>>>> [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0\DefaultPowerSchemeValues\a1841308-3541-4fab-bc81-f71556f20b4a] >>>>> "AcSettingIndex"=dword:00000e10 >>>>> >>>>> Cheers! >>>>> -Joe Rhodes > ------------------------------------------------------------------------------ > WatchGuard Dimension instantly turns raw network data into actionable > security intelligence. It gives you real-time visual feedback on key > security issues and trends. Skip the complicated setup - simply import > a virtual appliance and go from zero to informed in seconds. > http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk > _______________________________________________ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users > ------------------------------------------------------------------------------ WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users