Launchd: How to Run a Job Only When Waking?

I want to run a script when the computer wakes from sleep. I've read everything I can find about launchd and cannot find a solution.
I tried RunAtLoad, but it did not run the script when the computer woke from sleep.
Is there a parameter for launchd that will run a job only when the computer wakes from sleep?
I know other parameters like StartInterval will run any "queued" jobs when the computer wakes up, but I'm looking for a parameter that runs the job only when the computer wakes up.
Any help is appreciated.
Thanks
Brett

Sorry, but there is no capacity for that built into launchd.  You might be able to hack something together (I've tried before, with some limited success), but it will be easier and more stable to use sleepwatcher. 

Similar Messages

  • How to run procedure/job only on third business day of the month

    Hello All,
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.

    >
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.
    >
    For such a sparse schedule the easiest way is to DBMS_SCHEDULER and set the 'repeat_interval' using the BYDATE parameter.
    See Table 14-7 in chapter 114 DBMS_SCHEDULER of the PL/SQL Packages and Types doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sched.htm#BABEJGCH
    >
    Table 114-7 Values for repeat_interval
    BYDATE
    This specifies a list of dates, where each date is of the form [YYYY]MMDD. A list of consecutive dates can be generated by using the SPAN modifier, and a date can be adjusted with the OFFSET modifier. An example of a simple BYDATE clause is the following:
    BYDATE=0115,0315,0615,0915,1215,20060115
    The following SPAN example is equivalent to BYDATE=0110,0111,0112,0113,0114, which is a span of 5 days starting at 1/10:
    BYDATE=0110+SPAN:5D
    The plus sign in front of the SPAN keyword indicates a span starting at the supplied date. The minus sign indicates a span ending at the supplied date, and the "^" sign indicates a span of n days or weeks centered around the supplied date. If n is an even number, it is adjusted up to the next odd number.
    Offsets adjust the supplied date by adding or subtracting n days or weeks. BYDATE=0205-OFFSET:2W is
    >
    The chapter has examples.

  • How to run the job using DBMS_SCHEDULER

    How to run the job using DBMS_SCHEDULER
    pleas give some sample Iam very new to DBMS_SCHEDULER

    Hi
    DBMS_SCHEDULER
    In Oracle 10g the DBMS_JOB package is replaced by the DBMS_SCHEDULER package. The DBMS_JOB package is now depricated and in Oracle 10g it's only provided for backward compatibility. From Oracle 10g the DBMS_JOB package should not be used any more, because is could not exist in a future version of Oracle.
    With DBMS_SCHEDULER Oracle procedures and functions can be executed. Also binary and shell-scripts can be scheduled.
    Rights
    If you have DBA rights you can do all the scheduling. For administering job scheduling you need the privileges belonging to the SCHEDULER_ADMIN role. To create and run jobs in your own schedule you need the 'CREATE JOB' privilege.
    With DBMS_JOB you needed to set an initialization parameter to start a job coordinator background process. With Oracle 10g DBMS_SCHEDULER this is not needed any more.
    If you want to user resource plans and/or consumer groups you need to set a system parameter:
    ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;
    Baisc Parts: Job
    A job instructs the scheduler to run a specific program at a specific time on a specific date.
    Programs
    A program contains the code (or reference to the code ) that needs to be run to accomplish a task. It also contains parameters that should be passed to the program at runtime. And it?s an independent object that can referenced by many jobs
    Schedules
    A schedule contains a start date, an optional end date, and repeat interval with these elements; an execution schedule can be calculated.
    Windows
    A window identifies a recurring block of time during which a specific resource plan should be enabled to govern resource allocation for the database.
    Job groups
    A job group is a logical method of classifying jobs with similar characteristics.
    Window groups
    A window groups is a logical method of grouping windows. They simplify the management of windows by allowing the members of the group to be manipulated as one object. Unlike job groups, window groups don?t set default characteristics for windows that belong to the group.
    Using Job Scheduler
    SQL> drop table emp;
    SQL> Create table emp (eno int, esal int);
    SQL > begin
    dbms_scheduler.create_job (
    job_name => 'test_abc',
    job_type => 'PLSQL_BLOCK',
    job_action => 'update emp set esal=esal*10 ;',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=DAILY; INTERVAL=10',
    comments => 'Iam tesing scheduler');
    end;
    PL/SQL procedure successfully completed.
    Verification
    To verify that job was created, the DBA | ALL | USER_SCHEDULER_JOBS view can be queried.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_abc FALSE 0
    Note :
    As you can see from the results, the job was indeed created, but is not enabled because the ENABLE attribute was not explicitly set in the CREATE_JOB procedure.
    Run your job
    SQL> begin
    2 dbms_scheduler.run_job('TEST_abc',TRUE);
    3* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_ABC FALSE 0
    Copying Jobs
    SQL> begin
    2 dbms_scheduler.copy_job('TEST_ABC','NEW_TEST_ABC');
    3 END;
    4 /
    PL/SQL procedure successfully completed. Hope it will help you upto some level..!!
    Regards
    K

  • How to run a job in background programatically after 10 sec

    Hi Forum,
    Can anyone tell me How to run a job in background programatically after 10 sec..
    Thanks in advance

    Hi,
    Here is the example code
    *Submit report as job(i.e. in background) 
    data: jobname like tbtcjob-jobname value
                                 ' TRANSFER TRANSLATION'.
    data: jobcount like tbtcjob-jobcount,
          host like msxxlist-host.
    data: begin of starttime.
            include structure tbtcstrt.
    data: end of starttime.
    data: starttimeimmediate like btch0000-char1.
    * Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = ' '
                jobgroup         = ' '
                jobname          = jobname
                sdlstrtdt        = sy-datum    " You need to give the Date for execution the Job
                sdlstrttm        = sy-uzeit    " You need to give the Time for execution the Job
           importing
                jobcount         = jobcount
           exceptions
                cant_create_job  = 01
                invalid_job_data = 02
                jobname_missing  = 03.
      if sy-subrc ne 0.
                                           "error processing
      endif.
    * Insert process into job
    SUBMIT zreport and return
                    with p_param1 = 'value'
                    with p_param2 = 'value'
                    user sy-uname
                    via job jobname
                    number jobcount.
      if sy-subrc > 0.
                                           "error processing
      endif.
    * Close job
      starttime-sdlstrtdt = sy-datum + 1.
      starttime-sdlstrttm = '220000'.
      call function 'JOB_CLOSE'
           exporting
                event_id             = starttime-eventid
                event_param          = starttime-eventparm
                event_periodic       = starttime-periodic
                jobcount             = jobcount
                jobname              = jobname
                laststrtdt           = starttime-laststrtdt
                laststrttm           = starttime-laststrttm
                prddays              = 1
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = starttime-sdlstrtdt
                sdlstrttm            = starttime-sdlstrttm
                strtimmed            = starttimeimmediate
                targetsystem         = host
           exceptions
                cant_start_immediate = 01
                invalid_startdate    = 02
                jobname_missing      = 03
                job_close_failed     = 04
                job_nosteps          = 05
                job_notex            = 06
                lock_failed          = 07
                others               = 99.
      if sy-subrc eq 0.
                                           "error processing
      endif.
    Regards
    Sudheer

  • How to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    032ee1bf-8007-4d76-930e-f77ec0dc7e54 wrote:
    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also
    Please don't overwhelm us with so many details!  
    Just off the top of my head ... as a general approach ... something like
    nohup proca
    nohup procb
    nohup procc
    while (some condition checking that all three procs are still running ... maybe a ps -ef |grep  )
    do
    sleep 2
    done
    procd
    But, we'd really need to know what it is you are really trying to accomplish, instead of your pre-conceived solution.

  • How to run a job (program in it) every 48 hours

    Dear All,
    Can you please tell me how to run a job every 48 hours. I am not able to find suitable job option.
    Thanks and regards,
    Atanu

    Hi,
    1. Go to SM36 give the job name i.e. ZABC_MYJOB
    2. Click on Steps (Upper left corner - 2nd Button) and assign the ABAP report name .i.e. RSUSR002, Check and Save.
    3. Click on Start Condition (Upper left corner - Ist Button), click Date/Time and specify the Start Date and Time.
    4. Select "Periodic Job" and click on Period values now click on Other Period
    5. Now input 1 in the Minute Box. , and check and save.
    6. Again Check and Save. and Again Check and Save.
    7. Now save the job.
    This job will run after every 1 minut
    (OR) try the below steps.
    you can setup your job in order to start after an event.
    After that you can get the event triggered from the Operating System:
    - log into you Operating System with the SIDadm user id (at the Operating System level) and go to directory /usr/sap/SID/SYS/exe/run
    - Run the SAPEVT executable as follows :
    sapevt YOUR_EVENT -t pf=/usr/sap/SID/SYS/profile/DEV_DVEBMGS00_server001 nr=01
    This will raise the event, and cause the job scheduled within SAP to execute.
    In this way you can use the O.S. (u201Ccrontabu201D for example) functionalities in order to schedule your job between 9am to 6pm.
    Regards
    Shweta

  • Require password ONLY when waking from sleep

    Hello,
    There is a setting that enables a password both when waking from sleep AND when "waking" from screen saver.
    Is there a way to require a password ONLY when waking from sleep, but NOT when "waking" from screen saver?
    Thanks!

    It would appear that the two are inextricably linked. On the other hand, do you really need the screen saver? With an LCD screen it isn't really doing anything useful - you can't burn in static images nearly as easily as you can with a CRT display - and if you are using a laptop you would do much better to use the Energy Saver prefs pane to sleep the display after a period - this will extend the life of the backlight - and AFAIK no password is involved.

  • Launchd to run Applescript app. only when an iWorks program is running

    How can I make launchd load an applescript application (that autosaves documents) only when an iWorks program (Pages, Numbers) is running?
    I am using Launchd Editor or Lingon to right the plist file.

    There isn't a launchd trigger I'm aware of that will do this.
    The best you can do with launchd is a StartInterval which launches your application every n seconds and have the script perform the check to see if one of the target applications is running.

  • HOW TO RUN BODS JOB THROUGH UNIX SCRIPT

    Dear Experts
    Please provide me the way how to call a job by a script .
    I have used Export Execution Command as recommended by below links
    http://scn.sap.com/docs/DOC-34648
    http://scn.sap.com/community/data-services/blog/2012/08/22/sap-bods--running-scheduling-bods-jobs-from-linux-command-line-using-third-party-scheduler
    But I am not able to locate .sh  file in unix server .
    This is required to call a job after completion of parent job.
    Thanks
    Anupam

    You can check the status in "SAP Business Objects Data Services management Console", Below are the steps
    Login in SAP Business Objects Data Services management Console
    Click on Batch Job
    Select the local repository
    Then check your Job Execution status from there
    For your second query there are two ways one is do the same activity what you have done in DEV.
    below are the steps
    Login in SAP Business Objects Data Services management Console and export the Jobs using export execution command from batch job
    SHELL Scripts will be exported in Job Server Log
    Move that SHELL script as per your location
    Update the User environment variable same as DEV only difference is SID is changed
    Thanks,
    Daya

  • How to run the job under sys id

    Hello ,
    I wanted to run a job under sys id ( Batch user ) , as my authorisation is not sufficiant to run the repoting agent - Precalculation. Where as Batch user have all the roles for the same .
    I am in my login screen , and i wanted to run the job under batch user id ...could you please let me know how can i do it ?
    Regards,
    Manoj

    Hi,
    Try to schedule the job in background and see.
    Thanks,
    JituK

  • How to enable a button only when a tilelist item is selected

    Simple question but it seems quite awkward to me. How do I enable a button only when an item within a tilelist is currently selected?
    For example lets say if I have a button called button1 that is disabled by default and a tilelist called tilelist1 what would I have to add into the brackets of the following code (enabled property of the button) to ensure that the button is only enabled when an item in the tilelist is currently selected but disabled when no items are selected:-
    enabled="{}"

    enabled="{tilelist1.selectedItem}"
    that should do it, it's making an implicit comparision with null (tilelist1.selectedItem == null) which will result in a boolean.
    SelectedItem is null when nothing is selected , not null when something is.

  • How to run a job every month

    Hi guys,
    I know it's not right to ask others to create code for me, but I searched for a while and still blank. Can someone show me how to run myPackage.myProcedure every first day of the month (eg, Jan 1, Feb 1, March 1).
    I am thinking use this function, but I don't see how..
    DBMS_JOB.SUBMIT (
    job OUT BINARY_INTEGER,
    what IN VARCHAR2,
    next_date IN DATE DEFAULT sysdate,
    interval IN VARCHAR2 DEFAULT 'null',
    no_parse IN BOOLEAN DEFAULT FALSE,
    instance IN BINARY_INTEGER DEFAULT any_instance,
    force IN BOOLEAN DEFAULT FALSE);
    Any suggestions are welcome,
    Thank you
    Mike

    How come the first test works and the second test cannot find the procedure?? I am very confused now.. Also, how do I post code with indents? LOL
    SQL> DECLARE
    4 begin
    5 PRICE_PKG.CREATE_BUFFER_TBL;
    6 end;
    7 /
    PL/SQL procedure successfully completed.
    SQL> DECLARE
    2 v_Job NUMBER;
    5 BEGIN
    6 DBMS_JOB.SUBMIT(
    7 v_Job,
    8 PRICE_PKG.CREATE_BUFFER_TBL,
    9 LAST_DAY(SYSDATE)+1,
    10 TO_CHAR(TRUNC(LAST_DAY(SYSDATE)+1) + (6/24))
    11 );
    12 END;
    13 /
    PRICE_PKG.CREATE_BUFFER_TBL,
    ERROR at line 8:
    ORA-06550: line 8, column 36:
    PLS-00222: no function with name 'CREATE_BUFFER_TBL' exists in this scope
    ORA-06550: line 6, column 4:
    PL/SQL: Statement ignored

  • How to run a job automatically with file watcher

    Hi,
    I want to execute below job automatically when the file arrived in the oracle directory path..
    I am able to run the job manually.
    version details
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE 11.2.0.3.0 Production"
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    BEGIN
        SYS.DBMS_SCHEDULER.CREATE_JOB (
                job_name => '"UPN_COMMON"."EMPJOBS"',
                job_type => 'STORED_PROCEDURE',
                job_action => '"UPN_COMMON"."INS_EMP"',
                number_of_arguments => 0,
                start_date => TO_TIMESTAMP_TZ('2013-09-30 09:22:20 America/New_York','YYYY-MM-DD HH24.MI.SS TZR'),
                event_condition => '(1=1)',
                queue_spec => '"UPN_COMMON"."FILE_WATCHER"',
                end_date => TO_TIMESTAMP_TZ('2013-09-30 10:52:20 America/New_York','YYYY-MM-DD HH24.MI.SS TZR'),
                job_class => '"SYS"."DEFAULT_JOB_CLASS"',
                enabled => FALSE,
                auto_drop => FALSE,
                comments => 'TESTING A PROCEDURE',
                credential_name => NULL,
                destination_name => NULL);
        SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(
                 name => '"UPN_COMMON"."EMPJOBS"',
                 attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);
        SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(
                 name => '"UPN_COMMON"."EMPJOBS"',
                 attribute => 'max_run_duration', value => INTERVAL '1' MINUTE);
        SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(
                 name => '"UPN_COMMON"."EMPJOBS"',
                 attribute => 'schedule_limit', value => INTERVAL '1' MINUTE);  
        SYS.DBMS_SCHEDULER.enable(
                 name => '"UPN_COMMON"."EMPJOBS"');
    END;

    >I want to execute below job automatically when the file arrived in the oracle directory path..
    the code which results in the file arriving in the Oracle directory path needs to be enhanced to invoke the desired PL/SLQ procedure.
    file arrival is OS operation that Oracle knows nothing about &  is totally & completely oblivious to this event

  • How to run a job?

    Hi,
    I have a report which should regularly delete a directory on an app server.
    How to run this report as a job every 10 minutes?
    Thanks a lot,
    Olian

    Hi Olian,
    Follow the below steps:-
    1) execute SM36, give the job name.
    2) Click on "Start condition" on the top
    3) Select the approriate triggering way for e.g. if your report should start immediately then press "immediate" .
    4) Select the "Periodic job" check box
    5) Click on "Period values" and then click on "Other Period"
           give the time you wish to give like provide 10 in the   
           minute(s) field.
    6) Save!! it will work
    Also go to "Step" option on the SM36 to provide the report name which you want to execute.
    Thanks and revert back if you need more info.
    Harry

  • Pavilion zd7000 starts in battery mode only; runs on AC only when connected to printer by USB port

    My Pavilion zd 7379ea will only start up in battery mode. AC adapter appears OK with a firm green LED, so external power supply may not be the issue here? When I'm starting up (with what's left on the battery), both the charging LED and the AC LED are constantly blinking. When turned off, the battery LED is firm, and battery appears to be charging (but which obviously is not the case).  Occasionally, when computer is turned off, the AC LED is lit with a firm light.
    One odd thing I noted before this happened was that the computer ran on AC only when my HP printer was connected to one of the USB ports (no battery inserted). If I disconnected the printer USB cord, the computer just died immediately; it was like the computer was powered by the printer. Later I also discovered that the same cord (where it connected to the printer) had melted from extreme overheating. I tried to update the USB drivers for each port but it didn't change things. I also tried to connect a different printer to get the computer started but it didn't work this time. I'd be extremely grateful for any comments that may solve this power supply issue (and if possible explain the stuff with the printer connection).
    S/N{removed for privacy]; P/N PH989EA#AK8

    Hi,
    Schindi285460 wrote:
    My Pavilion zd 7379ea will only start up in battery mode. AC adapter appears OK with a firm green LED, so external power supply may not be the issue here? When I'm starting up (with what's left on the battery), both the charging LED and the AC LED are constantly blinking. When turned off, the battery LED is firm, and battery appears to be charging (but which obviously is not the case).  Occasionally, when computer is turned off, the AC LED is lit with a firm light.
    One odd thing I noted before this happened was that the computer ran on AC only when my HP printer was connected to one of the USB ports (no battery inserted). If I disconnected the printer USB cord, the computer just died immediately; it was like the computer was powered by the printer. Later I also discovered that the same cord (where it connected to the printer) had melted from extreme overheating. I tried to update the USB drivers for each port but it didn't change things. I also tried to connect a different printer to get the computer started but it didn't work this time. I'd be extremely grateful for any comments that may solve this power supply issue (and if possible explain the stuff with the printer connection).
    S/N{removed for privacy]; P/N PH989EA#AK8
    You unplugged a USB device while the notebook was still booted into Windows and on? 
    Normally that won't cause any issues but , If you did that you may have damaged your  system board's Southport chip.
    USB is not a plug n' play port like SATA  and eSATA are.
    Here is a link to the maintenence manual for your laptop series.
    Is your notebook still within warranty? By the processor components listed in the manual,I believe it is probably not.
    best regards,
    erico
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

Maybe you are looking for

  • My iPhone 5s keeps deactivating itself.

    Let it first be said that I jumped in a pool with my iPhone 5s. I was able to open it up, dry it out, and it was functioning fine until I left it out in a rainstorm. At first, everything was fine, but I started noticing that a few things were amiss.

  • ATV2 will not load photo libraries/folders

    Just connected ATV2 all appears to be working fine however when I try to access photos on my iMac it appears to be loading them stops and reverts to main menu. Should I be able to access slideshows in Aperture?

  • MOD video converter

    I am new to the mac world (13" air with upgraded RAM and processor and SSD).  I bought it to play around with imovie.  However, all my video files are in MOD format.  What video converter do you recommend and what output format do you recommend? Than

  • Faxing adobe pdf forms using actions in CRM service process

    Hi experts, Does anybody has experience in sending adobe PDF forms as a fax using actions in CRM service processes? Currently I use this by implementing a PPF BAdI, but what else configuration, software and hardware requirements I need to make faxing

  • Applet and Data Base. Help me PLEASE!!!

    Hi, I'm a brazilian man. Can a applet make consults in my data base each "x" seconds? I need open a frame with other applet inside him (the frame)... Open the frame after check a flag in my data base. Have you a source code for this problem? I hope y