Launchdaemon works manually but not at startup

I am trying to create a launchdaemon that will run a script to upload some information to our inventory server BEFORE login.
Here is the .plist located in /Library/LaunchDaemons
<?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>Inventory</string>
    <key>ProgramArguments</key>
    <array>
        <string>/ae_scan_mac</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
</dict>
</plist>
and here is the script it points to
#!/bin/sh
############ Server details ############
hostName="DOSSVCDSK"
portNo="80"
protocol="http"
############ Server details ############
SUPPORT="[email protected]"
PRODUCT="AssetExplorer"
COMPUTERNAME=`hostname`
OUTPUTFILE="$COMPUTERNAME.xml"
main()
          echo "##### Scanning Started #####"
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><DocRoot>" >$OUTPUTFILE
          constructXML "ComputerName" "hostname"
          constructXML "OS_Category" "uname -s"
          echo "<Hardware_Info>" >>$OUTPUTFILE
          constructXML "OS_Category" "sw_vers"
          constructXML "Memory_Information" "sysctl hw.physmem"
          constructXML "Memory_Information" "sysctl hw.usermem"
          constructXML "Memory_Informationw" "sysctl hw.memsize"
          constructXML "Memory_Information" "sysctl vm.swapusage"
          constructXML "Computer_Information" "hostname"
          constructXML "Computer_Information" "hostname -s"
          constructXML "CPU_Information" "system_profiler SPHardwareDataType"
          constructXML "Disk_Space" "df -k"
          constructXML "NIC_Info" "/sbin/ifconfig"
  #-----------Last logged in user name -----------
          constructXML "Software_Info" "/usr/sbin/system_profiler SPSoftwareDataType"
  #-------------Chipset, VRAM, Monitor display type, resolution---------------------
          constructXML "Monitoranddisplayinfo" "/usr/sbin/system_profiler SPDisplaysDataType"
  #--------------Sound card -----------------------------
          constructXML "SoundCardinfo" "/usr/sbin/system_profiler SPAudioDataType"        
  #---------------Memory modules----------------------
          constructXML "MemoryInfo" "/usr/sbin/system_profiler SPMemoryDataType"          
  #--------------Physical drives-------------------------
          constructXML "PhysicaldrivesInfo" "/usr/sbin/system_profiler SPParallelATADataType"    
  #--------------Harddisk info if no data is available in SPParallelATADataType------------
          constructXML "HarddrivesInfo" "/usr/sbin/system_profiler SPSerialATADataType"          
  #----------------Printer Info-----------------------
          constructXML "Printer_Info" "/usr/sbin/system_profiler SPPrintersDataType -xml"          
          echo "</Hardware_Info>" >>$OUTPUTFILE
          echo "<Software_Info>" >>$OUTPUTFILE
          constructXML "Installed_Softwares" "system_profiler SPApplicationsDataType -xml"
          echo "</Software_Info>" >>$OUTPUTFILE
          echo "</DocRoot>" >>$OUTPUTFILE
          echo "##### Scanning completed #####"
  #echo $data
          pushData
constructXML()
  ##Need to replace the < into &lt; , > into &gt; and & into &amp;#####
          echo "<$1><command>$2</command><output><![CDATA[">>$OUTPUTFILE
          eval $2 >> $OUTPUTFILE 2>&1
          echo "]]></output></$1>" >>$OUTPUTFILE
pushData()
        data=$(cat $OUTPUTFILE)
        eval "type curl > /dev/null 2>&1"
        if [ $? -ne 0 ]
        then
                echo "curl is not installed, so could not post the scan data to $PRODUCT, You can import the  $COMPUTERNAME.xml available in the current directory into $PRODUCT using Stand Alone Workstations Audit. Executing the curl command will lead to the installation."
                exit 1
        fi
          curl --header "Content-Type: text/xml" --data-binary @$OUTPUTFILE "$protocol://$hostName:$portNo/discoveryServlet/WsDiscoveryServlet?COMPUTERNAME= $COMPUTERNAME"
        if [ $? -ne 0 ]
        then
           echo "$PRODUCT is not reachable. You can import the  $COMPUTERNAME.xml available in the current directory into $PRODUCT using Stand Alone Workstations Audit. For further queries, please contact $SUPPORT."
        else
           rm -rf $OUTPUTFILE
           echo "Successfully scanned the system data, Find this machine details in $PRODUCT server."
        fi
main $*
I can get it to run manually, but it does not run during startup. I THINK the plist is actually running, because it seems to create the file (that I commented out the remove), but it does not upload it to our server. Could there be a problem with trying to access the network before login? Like maybe it doesn't have an IP at that point? I haven't tested it as a LaunchAgent, yet however all the research points to that being easier. I would like this to run regardless of someone logging in if possible though.
However, I have also created test .plist which points to a script that just "touches" a file, and that doesn't seem to work at startup either.
Any help would be appreciated.

launchd almost never fails silently - it's probably writing a more descriptive error message to the logs.  is there anything in console.app about this process?
one of the more common problems with launchdaemons is that they cannot do anything that requires the window server or any other post-login utility.  That's sometimes hard to diagnose.  for instance, you're using eval statements and echo statements: do the eval statements trigger anything that would require login context?  are the echo statements getting sent to a non-existant conole?  try sending those last status and error messages directly to the logs.

Similar Messages

  • Firefox will not open on my computer the majority of the time. If I shut down and restart it will work sometimes, but not always. This started recently in the last two weeks. Today is June 12th 2011.

    Firefox will not open on my computer the majority of the time. If I shut down and restart it will work sometimes, but not always. This started recently in the last two weeks. Today is June 12th 2011.

    See:
    * http://kb.mozillazine.org/Browser_will_not_start_up

  • HT1386 my Ipod will not connect to my computer it worked yesterday but not today and it is only a new ipod touch, it will not even be recognised on my itunes but yet it can charge off my computer. need help!

    it worked yesterday but not today and it is only a new ipod touch, it will not even be recognised on my itunes but yet it can charge off my computer. need help!

    iOS: Device not recognized in iTunes for Mac OS X
    or
    iOS: Device not recognized in iTunes for Windows

  • Occasionally Firefox 3.6.12 won't display photos on certain sites. Reloading works sometime but not alwasys.

    At times on auction some sites such as ebay, (and others), photos won't display. If I press the reload button there's a chance the photo will display. If reload doesn't work the first time, pressing it 3 or 4 times may work but not always. Closing the site then re-opening works sometimes but not always. Annoying.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • I can connect my Iphone 6 and Ipad Air to my Bose Soundlink but not my IMac.  I have tried all the usual solutions but nothing works.  It has worked recently but not in the last week. Help

    I can connect my Iphone 6 and Ipad Air to my Bose Soundlink but not my IMac.  I have tried all the usual solutions but nothing works.  It has worked recently but not in the last week. Help

    make sure it's not being connected to by any of the other two
    one can only connect 1 device at the time and just by waking up sometimes a headset connects to a device
    automaticly
    then forget the bluetooth device in OS X and put the headset in pairing mode / discovery mode and connect with it once again with the mac

  • 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!

  • cffeed caching works locally but not on server

    So I got my new Hostek account set up (woohoo!) and I've started uploading some basic files so I can do thinks like validate my code and make sure everything's working.  One thing that does not work (but does locally) is my news feed caching.
    Pulling in two RSS feeds was seriously slowing down my index page loading, so I stole a trick from Ray Camden on caching the feeds.  It works perfectly on my dev machine at home, but doesn't work on my hosted account.
    Here's the exact code being used:
    <cfset feedurl = "http://velonews.competitor.com/feed">
    <cfset cacheTime = #createtimespan(1,0,0,0)#>
    <cfif not structKeyExists(application,"rsscache") or dateDiff("n", application.rsscache.created, now()) gt cacheTime>
        <cffeed source="#feedurl#" query="entries">
        <cfset application.rsscache = structNew()>
        <cfset application.rsscache.data = entries>
        <cfset application.rsscache.created = now()>
    </cfif>
    <ul>
    <cfloop query="#application.rsscache.data#" startrow="1" endrow="6">
    <cfoutput><li><a href="#rsslink#">#title#</a></li></cfoutput>
    </cfloop>
    </ul>
    I tried wrapping a try/catch around the top section (above the <ul>) and still got nothing for an error message.  The page just stops being rendered at that first <ul>.
    I'm not sure why it works locally but not on the web server.  Any ideas?

    Miraculously, I got it working.
    I changed this:
    <cfloop query="#application.rsscache.data#" startrow="1" endrow="6">
    <cfoutput><li><a href="#rsslink#">#title#</a></li></cfoutput>
    </cfloop>
    To this:
    <cfoutput maxrows="6" query="application.rsscache.data">
    <li><a href="#rsslink#">#title#</a></li>
    </cfoutput>
    And bingo!  It worked. Perhaps it's an idiosyncrasy between CF9 and CF10.

  • Link to tabbed panel works once, but not again

    I have successfully linked from text in one tabbed panel to open another panel on the same page, using SpryURLUtils.js.
    <a href="?tab=2#TabbedPanels1">
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: params.tab ? params.tab : 0});
    When I return to the panel containing the link, the link no longer functions. So basically, it will work once, but not twice.
    Thoughts on what's happening?

    The example that you gave is great for opening a tab in a new page.To open panels on the same page see here http://labs.adobe.com/technologies/spry/samples/tabbedpanels/tabbed_panel_sample.htm
    Gramps

  • I'm having problems printing from my 15" macbook pro to my HP wireless printer. It works sometimes but not reliably, it can spend hours "seating for printer". I can print from my i pad with no problems

    I'm having problems printing from my 15" macbook pro to my HP wireless printer. It works sometimes but not reliably, it can spend hours "seating for printer". I can print from my i pad with no problems

    Hi,
    Apple's AirPrint only support specific models while using wired or wireless network connection.
    Plugging a printer into a USB port of Apple base is not supported for AirPrint:
    AirPrint printers connected to the USB port of the Apple AirPort Base Station or Time Capsules are not supported with AirPrint.
    As well you must use AirPrint enabled printers for a such, none of your printers are AirPrint enabled:
    http://support.apple.com/kb/ht4356
    There are 3rd party solutions which allow sharing a printer connected to your Mac as AirPrint, Printopia as example provide a such:
    http://www.ecamm.com/mac/printopia/

  • TS3989 Cannot get Photo Stream to sync on Windows 8.1.  Shared streams work fine, but not personal stream.  ANYONE please advise...

    Cannot get Photo Stream to sync on Windows 8.1.  Shared streams work fine, but not personal stream.  ANYONE please advise...

    Videos in a shared Photo Stream can only be streamed, they cannot be downloaded.

  • I BOUGHT an application from my iphone Application icon and paid 2.99 dollars too, for phone tracker , downloaded sucessfully and its working too but not tracking the phones as mentioned in the description can any one support me??? better from apple

    I BOUGHT an application from my iphone Application icon and paid 2.99 dollars too, for phone tracker , downloaded sucessfully and its working too but not tracking the phones as mentioned in the description can any one support me??? better from apple!!

    Is this the app you're referring to?
    http://itunes.apple.com/us/app/phone-tracker/id348537489?mt=8
    As you'll note it's made by Presselite and that page has a link to their support.
    Also, you'll find it best not to post questions about iPhone apps in the AppleWorks forum. Best to contact the makers of the app.
    Regards
    TD

  • I cannot get time machine (with airport) to back up my mac. It worked previously but not now. It is working on my macbook. the message i get is "Time Machine couldn't back up to '(airport network name)'"

    I cannot get time machine (with airport) to back up my mac. It worked previously but not now. It is working on my macbook. the message i get is "Time Machine couldn't back up to '(airport network name)'" Any help is appreciated.

    OS is important.. What OS is on Mac and what is on the working macbook?
    Was the Airport setup from the Macbook? That might be why it works from there..
    Does the AE show up in Mac airport utility?
    Can you mount the disk in finder and copy files to it/from it??
    Did you try a TM reset after mounting in Finder.. so you know it is available?
    What about a network reboot.. does it work post a restart for a few minutes/hours/days???

  • Hi, when I download wmv video files, I cannot get any sound. Youtube videos work fine but not wmv files? can somebody help please

    Hi, when I download wmv files on my MacBook Air I cannot get any sound on the videos. Youtube videos work fine but not wmv files. Can anybody help please?

    Install Flip4Mac which allows you to play wmv files.

  • [AS3] EventDispatcher works locally but not remotely

    Hi,
    I am very new to Action Script and have the following
    problem. I hope someone can point me in the right direction.
    I have a small video player app. I have added the FLVPlayback
    component to the stage and set some properties via action script
    (AS 3)
    I then instantiate a class to go and retrieve some XML,
    register an eventListener to wait for the XML to be loaded and once
    the event has fired, load the FLV file (just hard coded at the
    moment) into the FLVPlayback object.
    This works when testing in the Flash IDE but not when I
    publish the movie to my webserver. I have tried commenting out the
    player.load() and just adding a textfield and again this works
    locally but not when I publish to the webserver. I have included
    some code snippets below.
    Can anyone tell me where I am going wrong?
    Any pointers much appreciated.
    Thanks
    Martin

    Hi,
    I found the problem if anyone has the same issue. I was
    passing some FlashVars in incorrectly using the
    AC_RunActiveContent.js that comes with Flash. I have switched to
    swfobject and all is well.
    thanks

  • Flash site works locally but not online (uploaded to server)

    We have bought a flash portfolio template and have customized it with our pictures, video, etc.
    When we test it locally on our computer (using different web browsers) it all works perfectly well. We have uploaded the finished website to our server and when you go to the address online, it doesn't work (a loader progress shows but it is stopped and nothing happens).
    We have however uploaded the original template we bought and it works perfectly online.
    The template consists of and index.html, various .swf, and various .xml that we have modified according to the template instructions (it also contains a java script folder we haven't touched).
    What is it wrong with our modified template - it works locally without problem…!
    Thanks for your help

    When a Flash file works locally but not on-line, it's almost always a pathing issue (provided you did upload ALL files and do not have something missing... as suggested by Ned).
    A "pathing issue" results when the main .swf cannot find one or more of the associated Flash files...like an xml file or images.
    It can be something as simple as using switching file names to all lower case. Local machine is not case sensative... most servers are. So "My Photo.JPG" is not the same as "my_photo.jpg". When naming files, best to use all lower case, no spaces in any file or folder names... use_underscore_instead.
    But the most common cause is that those associated files (xml, images, etc.) are not pathed relative to the Web page where the main .swf is embedded. Pathing to the .xml and image files should be as though the .swf was located in the same folder as the Web page... NOT the actual location of the .swf file.
    And that includes paths to the xml file and paths to image files coded into those xml files. Everything need to be coded relative to the Web page.
    This topic has been covered a number of times here:
    http://forums.adobe.com/message/4368273#4368273
    http://forums.adobe.com/message/4294529#4294529
    http://forums.adobe.com/message/4280086#4280086
    http://forums.adobe.com/message/4267408#4267408
    Best wishes,
    Adninjastrator

Maybe you are looking for

  • Specify location of backup and autosave files?

    I'm still new to FrameMaker but making steady progress. I am transitioning over from Word and things are going well. Here's one feature I miss from Word: The ability to tell Framemaker where to store the backup and autosave files. My book has 40 docu

  • Trouble with OVS

    Hello Experts, I have the following situation, im trying to use a OVS in a test application that i'm built in. The thing is, that i only want that the search popup appear, i'm using nodes that doesnt have anything (data) just the structure for my tes

  • RE: Internal error in SAP OLE document container control

    Hi, When i execute the transaction for assigning standard document to an applicant activity, PBWW, i get an error message stating 'Internal error in SAP OLE document container control'.  Please help me out of this problem. We are using SAP version EC

  • Reverting to original filename issue

    Still pretty new to Lightroom and I made a workflow error that I cannot seem to fix. Wondering if anyone had any thoughts. When I import I put original files on my working drive and my backup drive. I then work off the working drive editing. When don

  • OS 10.x it missing the history for numbers not in contacts

    Maybe I'm blind I've just moved from 9360 OS 7 to the new Q5 and as first step, I've done the last update. I do receive many calls and to reconstruct the situation, before to e.g. recall a missing call, on OS7 (and previous) I was using the call deta