Command that Works in Terminal Not Running as Launch Agent

Trying to run the following command as a Launch Agent (OS X 10.7):
/usr/bin/find /Users/username/Documents/Dropbox/Public -type f -mtime +2 -print0 | xargs -0 rm -r
Created a plist file (reproduced below) and saved to ~/Library/Launch Agents, but the command isn't executed either at the specified time or when the agent is loaded via launchctl.
If I change the command to a simple Applescript test:
osascript -e 'tell Application "Finder" to display dialog "hello"'
It runs correctly as a launch agent when loaded and as the specified time
Which means there's something wrong with the first command (find). But the command runs as written when executed manually in the terminal.
Suggestions? Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
          <key>Label</key>
          <string>com.username.clean_dropbox</string>
          <key>ProgramArguments</key>
          <array>
                    <string>/usr/bin/find</string>
                    <string>/Users/username/Documents/Dropbox/Public</string>
                    <string>-type</string>
                    <string>f</string>
                    <string>-mtime</string>
                    <string>+2</string>
                    <string>-print0</string>
                    <string>|</string>
                    <string>xargs</string>
                    <string>-0</string>
                    <string>rm</string>
                    <string>-r</string>
          </array>
          <key>RunAtLoad</key>
          <true/>
          <key>StartCalendarInterval</key>
          <dict>
                    <key>Hour</key>
                    <integer>17</integer>
                    <key>Minute</key>
                    <integer>45</integer>
          </dict>
</dict>
</plist>

Since your pipe is essentially just passing the find matches to rm, you can achieve the same result using find's -delete switch:
/usr/bin/find /Users/username/Documents/Dropbox/Public -type f -mtime +2 -delete

Similar Messages

  • Constant Error; Adobe Flash Player 11.4 r402 has stopped working. But NOT running Trusteer Rapport.

    I am experiancing this unbelieveably annoying and constant Flash error;  Adobe Flash Player 11.4 r402 has stopped working.
    But NOT running Trusteer Rapport, I never have, and it's not even installed on my computer.  So what's causing this?

    There were a couple AntiVirus/AntiMalware products that keep coming up, but I haven't validated that in the lab and don't want to call anyone out publicly without reporting the issue to them first.

If you could tell me what antivirus/antimalware products and versions you have installed, that would be helpful.
    So, third party stuff aside, I'd like to know more about the crashes your seeing:
    1.) Please provide links to the Firefox crash reports.  If you have multiples, the first few would be great.
         In Firefox, type about:crashes in the address bar
         If the link starts with "bp...", it's already been submitted -- just right-click on it and copy the link, and paste it into the reply here.
         If not, click it to submit it, and copy the subsequent link.
    2.) In firefox, type about:support
         Just copy and paste the output into the reply.
    3.) In Firefox, type about:plugins
         Please copy and paste the output into the reply
    4.) Please provide the output of the DirectX Diagnostic Utility
         Click Start > type "dxdiag" [enter]
         Click Save All Information
         Copy the output of the file into the reply, or use Adobe SendNow/DropBox/PasteBin to share the file.
    5.) If you can provide an exact URL and step-by-step instructions on repeating the crash (if it's consistent), that would be really helpful.  My goal is to build out a configuration that matches yours as closely as possible, reproduce the problem and then debug it.
    If you're not comfortable sharing that diagnostic information publicly, send me a private message.  Just click my name and use the options on the right.
    Thanks!

  • FAIL: process disp+work.EXE Dispatcher not running

    Hi All,
    I've reinstalled OS and installed NW 7.01 ABAP Trial. The installation is fine (no error). At the time I "start application server" through "SAP NW 7.01 ABAP Trial Version => NSP => Start Application Server", it shows the error on command dos window as below:
    ===================================================
    ============== Starting System NSP ================
    ===================================================
    =============== Starting database instance ...
    The service name is invalid.
    More help is available by typing NET HELPMSG 2185.
    The MaxDB Database Starter, Version 7.7.04.23
    Copyright 2000-2008 by SAP AG
    OK
    ============== Starting ABAP instance ...
    The requested service has already been started.
    More help is available by typing NET HELPMSG 2182.
    12.10.2008 12:25:40
    Start
    OK
    12.10.2008 12:25:50
    StartWait
    FAIL: process disp+work.EXE Dispatcher not running
    ============== Start operation timed out !
    Press any key to continue . . .
    Please help me out,
    Peerasit

    Clean uninstall and delete 'sapdb; and 'SAP' folders. Then reinstall again.

  • HT4515 How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    Double tap the Home button, tap & hold the Safari icon until it starts to wiggle, tap the red minus sign to remove it from the Multi-Tasking bar. Tap the Home button when finished.

  • I have bought a iPhone 4 , yesterday . I heard that iOS 7 is not running properly on iPhone 4 , so I have decided to upgrade it to 6.1.2 . Please help to do this.

    I have bought a iPhone 4 , yesterday . I heard that iOS 7 is not running properly on iPhone 4 , so I have decided to upgrade it to 6.1.2 . Please help to do this.

    YOU CAN'T.
    If you upgrade your phone you can only upgrade to iOS 7 and that is it.  You can only ever update to the lastest available software, which in this case is iOS 7.  You either upgrade to this or not at all because you can't upgrade to anything else.

  • Fcsvr_client getmd works in Terminal, not from Response

    I've written a script that grabs the contents of a metadata lookup named PAENUM_CUSTCLIENTS and does some stuff with it. I get the contents just fine if I run the script from the command line, but I get absolutely nothing when running with a Subscription in FCS.
    The full command I'm executing:
    /Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/MacOS/fcsvrclivrclient getmd /enum/PAENUM_CUSTCLIENTS
    Run from the command line, my "clients" variable is 746 bytes long.
    Run from within FCS, my "clients" variable is 0 bytes long.
    I've tried piping the output of the command into a file instead of reading directly, but the file is empty. I'm thinking it's a shell problem, but I'm not sure. I am using Perl.
    Later in the script, I use "fcsvrclivrclient setmd", which works fine. Anything that outputs seems to not be readable, i.e., list_groups is also empty.
    Any help is much appreciated!
    Neil

    I have a pretty thorough Perl script to do this work. Here's the basic flow:
    • From FCS, I send the Asset ID, Device, and Location (file path).
    • Based on the path, I extract some keywords
    • One of these keywords is CLIENT, which is actually an ENUM in FCS
    • Because it's an ENUM, I verify that the CLIENT keyword based on the path is in the ENUM before setting it
    • I set all the keywords for the asset at the end
    So what breaks down is getting the ENUM content when executing from FCS even though that works fine running directly from the Terminal.
    Here's the lines in the script where I setup the command to get the CLIENTS ENUM:
    my $fcsvrClientCommand = "/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/MacOS/fcsvr_client";
    my $clientFetchCommand = "\"$fcsvrClientCommand\" getmd /enum/PAENUM_CUSTCLIENTS | /usr/bin/grep ENUM_ENTRIES";
    my $clients = `$clientFetchCommand`;
    Any other insights would be awesome! Sorry for not posting for so long, but we actually moved our offices over the last two months and that swallowed all my time. Let me know if there is something else I can post to help.

  • Have terminal NOT run a script when it loads

    I recently wrote a basic shell script and saved it as a .command file to run from the desktop. Since then, whenever I open the terminal it automatically runs the script then exits the terminal. If I hide the file (mv pt-noplugs.command .ptnoplugs.command) it simply opens the terminal and closes it immediately. I have tried changing the default shell from bash to something else but this doesn't seem to make a difference. I also don't seem to have a .bashrc file when it normally is /home/user/.bashrc (I'm used to linux). Any help would be appreciated. Below is the script:
    # Shell Script to start Pro Tools HD with no waveshell Plug-In
    echo "*"
    echo "* Script: pt-noplugs.command"
    echo "* Please Leave This Window Open Until ProTools Has Exited"
    echo "*"
    # Move waveshell Plug-In Files to Plug-Ins (Unused)
    cd "/Library/Application Support/Digidesign/Plug-Ins/"
    mv -v Waveshell-DAE_5.9.1.dpm "../Plug-Ins (Unused)"
    # Start Pro-Tools
    /Applications/Digidesign/Pro\ Tools/Pro\ Tools\ HD.app/Contents/MacOS/Pro\ Tools\ HD
    # Restore Plug-Ins directory
    cd "../Plug-Ins (Unused)"
    mv Waveshell-DAE_5.9.1.dpm ../Plug-Ins
    echo "*"
    echo "* Thank You. This Window May Now Be Closed"
    echo "*"
    exit

    I forgot to add: when I login as a different user and load terminal is does NOT run the script mentioned before.

  • Calendar utilities report that Calendar server is not running

    Hi All,
    When i try to use calendar server utilities e.g. uniwho, unistat, unicpoutu etc, I always get server is down or server is not running but while using other utilities e.g. uniical, uniuser, uniping works fine.
    I have started/stopped server many times using unistart/unistop but result is same. Web portal and windows client works fine.
    Can anybody guess, what can be the problem? Why some utilities can work and some can't?
    Thanks and Regards

    On other side opmnctl status shows that everything is alive ...
    Processes in Instance: ocsapps.qalotus1.in.zimbra.com
    ------------------------------------------------+---------
    ias-component | process-type | pid | status
    ------------------------------------------------+---------
    HTTP_Server | HTTP_Server | 3192 | Alive
    DSA | DSA | 3176 | Alive
    LogLoader | logloaderd | N/A | Down
    dcm-daemon | dcm-daemon | N/A | Down
    WebCache | WebCache | 4668 | Alive
    WebCache | WebCacheAdmin | 3076 | Alive
    OC4J | OC4J_OCSClient | 3708 | Alive
    OC4J | OC4J_Mail | 3304 | Alive
    email | email_housekeeper | 3560 | Alive
    email | email_imap | 4792 | Alive
    email | email_listserver | 4832 | Alive
    email | email_nntp_in | 5496 | Alive
    email | email_nntp_out | 2800 | Alive
    email | email_pop | 2284 | Alive
    email | email_smtp_in | 5848 | Alive
    email | email_smtp_out | 5756 | Alive
    email | email_virus_scrub~ | 4844 | Alive
    CalendarServer | Calendar_CSM | 3704 | Alive
    CalendarServer | Calendar_CWS | 4404 | Alive
    CalendarServer | Calendar_DAS | 3976 | Alive
    CalendarServer | Calendar_SNC | 1480 | Alive
    CalendarServer | Calendar_ENG | 4276 | Alive
    CalendarServer | Calendar_LCK | 4516 | Alive
    how can be so contradictory status information? Or its me only who cant interpret it in correct way?

  • ICal working even when not running

    I'm not sure if this related to Snow Leopard (which I recently installed) or not as I don't normally shut down iCal.
    However, I shut down iCal and I'm still getting the iCal alerts. I have verified that it is not running.
    How do I shut down iCal so as to not have my reminders pop up (while I do not have the application running) and why would it give me reminders when it's not running, anyway.

    Take a look at the setting of "Turn off alarms only when iCal is not open" in iCal's Advanced preferences. If you don't want alarms when it is not running, select this option. Most people, I suspect, do want them - if you want to be reminded of something, you don't want to be not reminded 'cos you have forgotten to leave iCal running.
    It is not a Snow Leopard change.
    AK

  • Terminal not running commands.

    I recently tried running a command to uninstall Xcode "sudo /Developer/Library/uninstall-devtools –mode=all" but it failed after asking me to enter a password. Now after I run the Terminal I get nothing for a response and the window is now named "Terminal-login-86x24". I looked for everything online and on Apple support. What should I do?

    paniclabs wrote:
    I recently tried running a command to uninstall Xcode "sudo /Developer/Library/uninstall-devtools –mode=all" but it failed after asking me to enter a password. Now after I run the Terminal I get nothing for a response and the window is now named "Terminal-login-86x24". I looked for everything online and on Apple support. What should I do?
    That command looks incomplete. From the readme:
    ++++++++
    Uninstalling Xcode Developer Tools
    To uninstall Xcode developer tools on the boot volume along with the <Xcode> directory, from a Terminal window type:
    $ sudo <Xcode>/Library/uninstall-devtools --mode=all
    To remove the underlying developer content on the boot volume, but leave the <Xcode> directory and supporting files untouched, from a Terminal window type:
    $ sudo <Xcode>/Library/uninstall-devtools --mode=systemsupport
    To just remove the UNIX development support on the boot volume, but leave the <Xcode> directory and supporting files untouched, from a Terminal window type:
    $ sudo <Xcode>/Library/uninstall-devtools --mode=unixdev
    Finally, to just uninstall the <Xcode> directory you can simply drag it to the trash, or from a Terminal window type:
    $ sudo <Xcode>/Library/uninstall-devtools --mode=xcodedir
    NOTE: The uninstaller that ships with previous versions of the Xcode developer tools will not clean everything off of your system properly. You should use the one installed with these Xcode developer tools.

  • HTC Incredible reboot fix that works and does NOT require hard reset

    Like many of you unfortunate souls out there I have had my HTC Incredible go into a rebooting loop over the last month or so. The following recounts some observations and and a solution which appears to work.
    First off, my son and I both have the same phone and software versions and apps. He does NOT get email on his phone because he does not want to. I do. His phone has NEVER rebooted. Mine has done so numerous times. My business partner also has the identical phone and software version, lives within 200 yards of me,  and uses the email and has had numerous reboots and has gotten them even sooner than I saw them at first. My partner and I have set up email attachments and downloads to go to the SD card. So much for background info. Here is what I did to fix the problem followed by some other observations:
    Open up the case of the phone and remove the battery
    Remove the SD card from the phone.
    Put it into an adapter that allows you to access files directly on your computer. In my case this was a Windows PC running Windows 7.
    Mount the SD card in your computer and open up the browser to see the files on the SD card.
    Look for a folder called ".Mail"
    If your phone is like mine you will see hundreds of files, some of zero length. This was even though I had deleted most of the emails I received on my phone.
    Proceed to directly delete any of the zero length files. For that matter, you may have other files like jpg's laying around of uncertain origin. I got rid of these and other strange files that seemed attached to no documents at all.
    Remove the SD card and reinsert into your phone. Put the battery back in and the cover on then restart the phone. Your phone should run properly and you should not see any negative consequences from the files you deleted previously.
    Some other observations relevant to this solution that bolsters my theory that this problem has something to do with the email application and also a problem with file system corruption on the SD card as a consequence of it.
    I had previously seen the email application put some mail from a different account I was using into my main account. The files could not be deleted and even trying to do so would cause the mail app to force close.
    My son has never seen the problem despite being in the same environment with the same phone and software. Relevant difference to me was that he was NOT using email and I was.
    The email app clearly has bugs if it is leaving behind hundreds of files even if you delete the emails. Why? As a software engineer my first instinct would be to look to see if the file system locks were properly synchronized when the email app is writing to the flash file system. I am not conversant in Android OS programming nor the app code itself so this is speculative on my part. I would also look for a timeout on reboots if file system enumerations take too long. Lots of files on a system might trigger a premature timeout and reboot. Once again, this is speculative on my part but I sure wish I had the code to debug this myself.
    These issues seem to coincide with a rapid rise in network traffic most likely because of the iPad 2/iPhone support by Verizon. I wonder if this additional traffic load on the network is opening up timing holes in the software because of backoff and retry intervals for certain apps. Once again I suspect the email app especially because it is vulnerable to network traffic issues as it tries to get email account updates.
    I could be wrong about my theory as to why the problem is happening. My solution seems to work. As far as pulling the battery and putting it near your AC in the car, that did NOT work for me at all. Leaving the phone out of its protective case also had no effect. Only screwing with the files on the SD card mattered.
    I hope this helps. 

    This problem has been seen for MONTHS now by people besides myself. My business partner is about to put a bullet in his phone because this has been happening for far longer than mine. I have little confidence in a fix anytime soon because this problem has been persistent for some time and there is a lot of denial in the field by Verizon. Verizon has to depend on HTC and Google besides themselves for fixes. How much would you like to wager on how this business relationship is working out? The first step in any solution is for a company to take some responsibility for it and so far no company has.

  • How do I change the compatibility view so that my words are not running off the page?

    I do data entry and in the system I am working on the words are running off the page. In internet explorer there is a little broken page on the tool bar that lets you change the compatibility and I am not finding anything like that with firefox. Please advise how I can change the setting so that the words will wrap correctly.

    As far as I know, Firefox doesn't have a similar compatibility feature.
    I assume this system is not accessible to forum volunteers, so I'm going to ask you to do a little sleuthing. I assume you are entering text in a multi-line textbox (an HTML &lt;textarea> control). Could you do the following:
    * Have your text entry form open in one tab, and a reply to this thread in another tab.
    * Right-click in the control that doesn't wrap and choose Inspect Element. A small pane should open with part of the HTML highlighted in blue.
    * Right-click the highlighted &lt;textarea> tag and choose Copy Outer HTML.
    * In your reply tab, paste the HTML, and remove the leading &lt; character to avoid messing up your post. This will show any legacy settings on the tag that might be affecting how it wraps.
    Here's an example using this very box:
    textarea style="width: 567px; height: 616px;" rows="10" name="content" required="required" placeholder="Enter your reply here." cols="40" id="id_content"></textarea>
    If it's not a textarea, then that would be useful to know as well.
    * Back in your form, you may or may not have a pane to the right that shows various style rules. If not, click the Style button at the lower right to open it. Look for any rules with the '''white-space''' property (the properties normally appear in colored text). If you find one, right-click and choose Copy declaration line. Switch back to this tab and paste the rule.
    With that information, hopefully we can find a workaround.

  • Javascript that worked in CS4 not working in CC

    I wrote a Javascript tool that creates perspective grids in Photoshop a while ago.  It works fine in Photoshop CS4.  However, I've been getting a few emails complaining that it does not work in CC.  I've checked the CC release of the Javascript in Photoshop reference guide, but it appears that nothing has changed relevant to my code since CS4.  Any idea what's happening in PS that is causing this script to fail?
    http://kitfox.com/projects/photoshopPersp/Perspective%20Grids.jsx
    Full webpage:
    http://kitfox.com/projects/photoshopPersp/index.html

    I've changed the script.  I now create my path layer using the below function.  However, even after explicitly changing the ruler units to PIXELS, the paths I create all seem to be measured in POINTS.  Even if the original ruler unit is PIXELS this still happens.  Is there any way around this (that is backwards compatable)?
    function createPathLayer(title, subPathArray)
        var docRef = app.activeDocument;
        var originalUnit = app.preferences.rulerUnits;
        alert("Orig units " + originalUnit);
        app.preferences.rulerUnits = Units.PIXELS;
        var myPathItem = docRef.pathItems.add(title, subPathArray);
        alert("New units " + Units.PIXELS);
        app.preferences.rulerUnits = originalUnit;

  • FireFox has stopped working and will not run after fresh install

    Yesterday I noticed that the address bar was not working and the graphics were not being shown correctly. When I typed in the address bar it would no atuto complete and even if i typed yahoo.com nothin would happen. The only way I could go to a website was to use my bookmarks.
    I did a fresh install and now it doesn't work at all. So, I uninstalled firefox and then did a fresh install. Sill nothing. IE, Chrome, and Safari work fine.

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.com/kb/Server+not+found
    *https://support.mozilla.com/kb/Firewalls
    See also:
    *http://kb.mozillazine.org/Browser_will_not_start_up

  • Since installing OS X Lion, I get a message that Community Toolbar will not run on this setup every time I open Safari.  How do you eliminate this message?

    Since installing OS X Lion, I get a message every time I open Safari that states "Community toolbar-We're sorry, but the Safari browser version you are currently using does not support the community toolbar."  I am using version 5.1.  How do I get rid of this message?

    Delete the app, add-on, or extension that loaded the community toolbar. Try a search for community toolbar to learn the details.

Maybe you are looking for

  • How can I move an iPhoto library from from one Mac to another?

    How do I take a 30 GB iPhoto library from my home iMac (OSX 10.6.8) to work and combine the data with my my iPhoto Library on my work MacMini?

  • LSMW Vendor XK01 Session Failed to create

    Hi all, I am trying to upload vendor data using LSMW using direct batch program RFBIKR00 . Would like to store Compnay code level details also. I did have Compnay code 0001  in FIle..I checked Converted data also, but getting below error .... FB012  

  • How to use PIVOT for varchar field

    Have data (records) as such: Joe, Smith, PersonType1 Joe, Smith, PersonType2 Joe, Smith, PersonType3 Joe, Smith, PersonType4 Joe, Smith, PersonType5 However need to present it within ONE row per/Person with the PersonType in columns within this same

  • Changing the mouse pointer to a cursor?

    Hi, I am using a graph or perhaps a polar plot, not sure yet, but I realy wanted to know if there is any way to make the mouse pointer act like a cursor, such that I can click on something on the graph and know where the mouse clicked (the coordinate

  • Sichere Verbindung herstellen

    Hallo, ich habe schon alles mögliche Probiert, Itunes nach PLAN neu installiert, HOSTS geändert....andere Einstellungen und ich kann einfach keine sichere verbindung herstellen. ich kann auch kein backup machen, es bleibt bei schritt 2 von 8 stehen.S