Script to take pictures of desktop every 10 minutes.

Hi,
I have a headless server. It has a problem I cannot recreate manually.
It is programmed to do a restart and if this fails to do a forced restart. However when it does the forced restart I would like to know what is happening and why it failed. So I thought if I have it take pictures of the desktop I might see what dialogue boxes are open and hence find what programme is hanging and stopping the restart.
I would also like it to repeat this procedure every (lets say) 10 minutes.
I have broken my head over the script (I am not very good) to no avail. Any help out there?

http://discussions.apple.com/thread.jspa?threadID=1476873&tstart=0
Reposted as forum server disallowed me to edit it.

Similar Messages

  • Script to take pictures of desktop and mail results

    Hi,
    I am reposting as posted before finishing and I can not edit the message, > server tels me I am not allowed to edit.
    I have a headless server. It has a problem I cannot recreate manually.
    It is programmed to do a restart and if this fails to do a forced restart. However when it does the forced restart I would like to know what is happening and why it failed. So I thought if I have it take pictures of the desktop I might see what dialogue boxes are open and hence find what programme is hanging and stopping the restart.
    This is what I found from dev_sleidy (http://discussions.apple.com/thread.jspa?messageID=6670993&#6670993):
    set dFolder to "~/Desktop/screencapture/"
    do shell script ("mkdir -p " & dFolder)
    repeat 2 times -- Repeat 2 times.
    set tTime to do shell script "date +%H%M%S"
    do shell script ("screencapture " & dFolder & tTime & ".png") -- Capture screen.
    delay 30 -- Wait for 30 seconds.
    end repeat
    So far so good it works.
    Now I want this file to be send per email to me, for which it first needs to be compressed, unless I send all the individual pictures which would also be fine as well.
    How would I do this using mail?
    I have broken my head over the script (I am not very good) to no avail. Any help out there?

    01. Code with '.zip' file attached to each e-Mail message.
    -- Code starts here --
    property tAddress : "[email protected]" -- e-Mail address.
    set tFolder to ((path to desktop folder from user domain) as string) & "screencapture" & ":" -- Screen capture folders' path.
    set dFolder to quoted form of (POSIX path of tFolder) -- Screen capture folders' path, in UNIX form.
    repeat -- Infinite loop.
    do shell script ("mkdir -p " & dFolder) -- Create 'screencapture' folder.
    set tTime to do shell script "date +%H%M%S" -- Obtain current time.
    do shell script ("screencapture " & dFolder & tTime & ".png") -- Capture screen.
    do shell script "zip -r -j " & (dFolder & tTime & ".zip") & " " & (dFolder & tTime & ".png") -- 'zip' the '.png' file.
    tell application "Finder" to set tAttachments to files of folder tFolder whose name contains ".zip" -- Obtain list of all '.zip' files.
    if ((count tAttachments) > 0) then -- If list of '.zip' files exist, continue.
    delay 2
    tell application "Mail"
    activate
    set nMessage to make new outgoing message with properties {visible:false, subject:tTime, content:"" & return & return}
    tell nMessage
    make new to recipient at end of to recipients with properties {address:tAddress}
    tell content
    repeat with i in tAttachments -- Cycle through '.zip' files, attaching each to e-Mail message.
    make new attachment with properties {file name:((i as string) as alias)} at after the last paragraph
    end repeat
    end tell
    send -- Send the e-Mail message.
    end tell
    end tell
    delay 3
    do shell script ("rm -rf " & dFolder) -- Delete 'screencapture' folder.
    end if
    delay (60 * 10) -- Delay for 30 minutes.
    end repeat
    -- Code ends here --
    02. Code with '.png' file attached to each e-Mail message.
    -- Code starts here --
    property tAddress : "[email protected]" -- e-Mail address.
    set tFolder to ((path to desktop folder from user domain) as string) & "screencapture" & ":" -- Screen capture folders' path.
    set dFolder to quoted form of (POSIX path of tFolder) -- Screen capture folders' path, in UNIX form.
    repeat -- Infinite loop.
    do shell script ("mkdir -p " & dFolder) -- Create 'screencapture' folder.
    set tTime to do shell script "date +%H%M%S" -- Obtain current time.
    do shell script ("screencapture " & dFolder & tTime & ".png") -- Capture screen.
    tell application "Finder" to set tAttachments to files of folder tFolder whose name contains ".png" -- Obtain list of all '.png' files.
    if ((count tAttachments) > 0) then -- If list of '.png' files exist, continue.
    delay 2
    tell application "Mail"
    activate
    set nMessage to make new outgoing message with properties {visible:false, subject:tTime, content:"" & return & return}
    tell nMessage
    make new to recipient at end of to recipients with properties {address:tAddress}
    tell content
    repeat with i in tAttachments -- Cycle through '.png' files, attaching each to e-Mail message.
    make new attachment with properties {file name:((i as string) as alias)} at after the last paragraph
    end repeat
    end tell
    send -- Send the e-Mail message.
    end tell
    end tell
    delay 3
    do shell script ("rm -rf " & dFolder) -- Delete 'screencapture' folder.
    end if
    delay (60 * 10) -- Delay for 30 minutes.
    end repeat
    -- Code ends here --

  • Creating script to take picture and email it

    I recently read an article about someone who created an automator script that would take a picture using a MacBook iSight camera and email it each time the MacBook awoke from sleep. Several laptops have been stolen from my workplace and I thought this would be a great way of figuring out the thief were my laptop ever stolen.
    When I looked at the script, I noticed that it opens up PhotoBooth and Mail so that the user in front of the computer would see that their picture was being taken and that an email message was sent.
    In the name of stealthness, I was hoping to duplicate this process in a unix script. I have a few pieces figured out, but I need some guidance on other issues.
    What I know:
    1. How to use sleepwatcher to call a unix script upon the MacBook waking.
    2. How to take a stealth image using the commandline command "camcapture".
    What I would like to know
    1. What unix command could I use to check to see if the MacBook has a viable internet connection?
    2. If there is a viable connection, send an email with the image taken to a particular email address and with a particular subjectline.
    3. If there is not a viable internet connection, save the email and check for a viable internet connection each 5 minutes (or so) and send the email as soon as an internet connection is achieved.
    Thank you in advance for any guidance you can offer.

    Hi Mahongue,
       I'm sorry for being absent for a while but in your case that seems to have been a good idea. I think you deserve the star more than I because you seemed to have worked it all out. Of course I couldn't tell you what server your e-mail account uses but it doesn't matter that much in the ping statement. If you can ping mail.yahoo.com, I'm sure that would indicate that you have an internet connection that would allow you to send mail to a yahoo account. I see your point about e-mail being the best solution in case you don't have a reliable server of your own. Of course you can get around the dynamic IP address the way I do, with DynDNS.org. They allow you to change your DNS listing programmatically and you do that at boot. Of course that wouldn't allow you to reliably scp to that machine unless it's always up.
       Your idea of testing the return value of ping command will work in principle. I tested it and ping returns an error if either the lookup fails or the ping times out. I've never used the syntax you did in the if clause. What shell are you using? In a Bourne-type shell, you shouldn't need the parentheses. You could use something like:
    if ping -c 1 mail.yahoo.com >/dev/null 2>&1; then
       <Invoke Network Usage>
    fi
    The redirection avoids cluttering the output of your script with the ping output.
    If you're interested, the CheckForNetwork function in the /etc/rc.common script is:
    # Determine if the network is up by looking for any non-loopback
    # internet network interfaces.
    CheckForNetwork()
       local test
       if [ -z "${NETWORKUP:=}" ]; then
       test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
       if [ "${test}" -gt 0 ]; then
          NETWORKUP="-YES-"
       else
          NETWORKUP="-NO-"
       fi
       fi
    and usage is:
    CheckForNetwork
    if [ "${NETWORKUP}" = "-YES-" ]; then
       <Invoke Network Usage>
    fi
    If you copy-and-paste any of this code, be sure to replace the non-breaking spaces used for indention with real spaces.
       Thanks for the link to the mail_files script!! That is really impressive! Naturally I saved it. The link you posted is broken at the moment but it's probably one of those sites that throttle traffic by shutting it down for a while when it's "overused". Maybe you've made him popular. Anyway, I got a version of the same script elsewhere but mine says that the uuencoding is untested. Yours doesn't say that, does it? Have you tested that with your version?
       Dave's script still uses Perl to do base64 encoding. It should still be possible to do this in Perl and there are advantages to letting library code handle certain tasks. That way, if a protocol changes someone will likely upgrade the library for you. I think that on another thread you asked about how to add an attachment in the code that we were discussing on that other thread. However, I thought you said that you had Perl code to do that. I was just suggesting that you put the two together.
    Gary
    ~~~~
       The party adjourned to a hot tub, yes.
       Fully clothed, I might add.
             -- IBM employee, testifying in California State Supreme Court

  • Good morning, i would like to know how to take pictures from iphoto and put them in a folder on desktop

    Good morning: would like to know how to take pictures from my iphoto and put them in a folder on my desktop

    To take photos from iPhoto and put them onto a folder on Desktop, first create a folder on Desktop. Right-click on Desktop and create a new folder.
    Then, open iPhoto, and you have two ways to export photos:
    1. Select the photos you want to copy to Desktop with Command key (or go to Edit menu > Select All, if you want to copy all photos), and then, drag them to the folder on Desktop.
    2. Select the photos you want to copy to Desktop with Command key, go to File menu > Export, and follow the steps.
    You can choose the one you prefer

  • How to take voltage measurements every minute

    Hi all,
    I am currently new to labview and i am trying to take timed voltage measurements.  Here is what i am trying to do;
     I am using labview 2010 and I am trying to take temperature and humidity readings in sync with each other.  To measure the temperature i am using a cDaq and mudule 9213, for humiduty i am using the voltage from module 9234 and converting it using the ambient temperature and voltage from my humidity sensor.  
    Now what i want to do is take voltage and temperature measurements say every minute or 30 seconds, but my buffer fills from the voltage readings and gives me an error or the table takes values from what im assuming is the buffer, one by one, instead of grabbing the current data from the module.  
    My real question here is how do i take current voltage measurements every 30 seconds?
    Thank you for any advice.
    Solved!
    Go to Solution.

    Did you stop your VI when changing voltages?  It would make since if you did since the chart will retain its memory while the table's Express VI is reset with each run.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Finder resets every minute

    Last week I upgraded my ibook from 10.4.8 to 10.4.9 via software update. i think i also updated quicktime and iTunes at the same time. After doing this I began experiencing a problem i've never seen before in which the finder 'resets' every minute or so, regardless of what program i am running. the desktop items disappear for a few moments and when they reappear, i'm "in" the finder and have to click on the window of the progam i'm in to continue using the program (e.g. if i'm typing in Word or Mail, i have to click on that doc in order to continue typing, something i've done 3 times since beginning this message). I downloaded 10.4.9 combo and installed that. no change. i thru away the system and finder preferences in my library. no change, and the finder prefs renews itself at every 'reset'. there is no 'finder reset' option from the finder dock icon like there once was--the only option is "hide". Any suggestions?

    I suspect the magic word is "StuffIt"--for some reason its various add on goodies frequently have unfortunate effects on the Finder.
    Restart and hold down the Shift key as soon as you hear the startup chime. This will boot you into Safe Mode, which will repair the disk, clean a couple of caches, and disable ALL third party startup items (and a few of Apple's too). The start will take longer than normal as it does all this. The Finder should now work normally, and you can start looking for Stuffit add ons: check here:
    "/Users/yourname/Library/Contextual Menu Items"
    "/Library/Contextual Menu Items"
    If you find something from StuffIt in either location, drag it to your Desktop. Also launch System Preferences, go to Accounts and click the Login Items tab. If there is something in there from StuffIt click on it to select, then click the minus button at the bottom. Now restart normally and see if the Finder is working correctly.
    Francine
    Francine
    Schwieder

  • 8130 camera comes on and takes pictures constantly

    I have an 8130 series Pearl, and for the past couple of days I've had the problem where instead of my screen going black (sleep mode) after it's been sitting idle for 30 seconds, it switches to the camera and starts taking pictures about every 30 seconds. It takes pictures constantly while I'm on the phone (I've even deactivated the right side button so I know I'm not hitting anything accidentally) and if I shut off the phone completely, it will not power on with the red button unless I remove and replace the battery. 
    I was previously an alltel client but they've switched to Verizon, so I'm not sure what to do from here.
    I don't know how to wipe the OS and reload it - is my only option from here to go into a store and have them look at it?

    Hello CrowScraps,
    Welcome to the BlackBerry Support Community Forums.
    In this case we can try to reload the software on the BlackBerry smartphone to make sure it is running the latest version and there are no issues with the OS.
    To do this we would need to back up the BlackBerry smartphone. Please open the BlackBerry Desktop Manager and connect your BlackBerry smartphone. Click on the Backup and Restore button and select Back Up. Please note the location where the backup is being saved as we will need to access it later to restore the BlackBerry smartphone.
    Once you have backed up your BlackBerry smartphone please follow the link below to complete a clean reload of the BlackBerry smartphone software.
    Link: http://www.blackberry.com/btsc/KB11320
    Test the BlackBerry smartphone prior to restoring the backup.
    Thank you
    -DrP
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • Invoke runbook every minute

    This may possibly be a stupid question but I'm going to ask anyway ;-)
    We have created a runbook to provision users in Lync, and this runbook goes every minute. I have the box ticked for wait for completion on the invoke runbook activity.
    On enabling a handful of users the process is very quick, but we're getting to a point in our lync deployment that we are adding sometimes over 100 users at a time. I'm seeing some errors that I can't really correlate with anything else, so my question is
    this.
    If a runbook runs every minute, and the data it's working on takes more than a minute to complete, will the runbook religiously spawn every minute and perhaps trample on work of a previous runbook?
    Jeffrey S. Patton Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 (785) 864-0242 | http://patton-tech.com

    Ryan,
    I've double-checked my runbook and have that set, and yet I'm seeing what appears to be the runbook running multiple times. As it runs every minute, under the Log tab I saw several instances with a status of running.
    My runbook is actually two, the first has the every minute schedule, and the invoke runbook activity that passes data over to the second part of the runbook that actually does the work. This worker runbook has an init data activity, and then three script
    activities that carry out the work of getting a list of users from AD that meet the provisioning criteria, then enable a given user, and finally clear out the provisioning criteria.
    On the invoke runbook activity, I also have set wait for completion to be true. If what I'm seeing is normal then cool, otherwise i'm inclined to put in some sort of check just to make sure.
    Jeffrey S. Patton Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 (785) 864-0242 | http://patton-tech.com

  • Firefox keeps crashing at random times every minute or so, need help.

    Firefox crashes pretty much every minute I browse the internet. Sometimes even if I just leave it there doing nothing. I've tried safe mode. I've tried disabling hardware accaleration. I've tried creating a new firefox profile. I've tried disabling flashplayer protected mode. Nothing worked so far. Oh and I can enter some websites through firefox for a shortwhile before it crashes but I've noticed that going to imdb.com and mozilla.org causes it to crash instantly don't know if it helps.
    Here are the lat 5 crashes:
    <pre><nowiki>0da6cbf3-643b-4a8b-bcb2-5ec0c983b213 7/20/20139:18 PM
    bp-281e3c83-b2e2-41c9-9484-d15622130720 7/20/20139:12 PM
    bp-459a2a4c-381e-4dc3-ad4a-2566d2130720 7/20/20138:57 PM
    bp-3e06e070-6314-4284-81b8-323a12130720 7/20/20138:57 PM
    bp-bf666492-3cd5-41cd-bea2-3a6752130720 7/20/20138:49 PM</nowiki></pre>

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Why does my mouse keep losing connection every minute

    why does my mouse keep losing connection every minute, its not the batteries

    I'm having the same issue.  Every so often it loses connection then re establishes. This goes on repeatedly.
    If you change batteries while the computer is still active then it takes for ever to re connect.
    Can't wait until someone replies to your question.

  • Ghost Pictures of Desktop and Screen Saver best practice.

    My Apple LCD Screen have only about 10 month and sometime i can see the edge of desktop picture who in my case is the Apple Rocks Collection Desktop Picture , i use 30 minutes before Screen Saver kick-in and 30 minutes before LCD Screen go to sleep .... is this a case of picture burning itself in the LCD Screen , is this irreversible or someting can be done about-it ....
    For now i have reduce to 15 minutes before the Screen Saver kick-in and 30 minutes before the LCD Screen go to sleep , so now instead it is 30 minutes not 60 minutes before the screen go to sleep.
    What is your best advice since as a video editor when the LCD Screen Saver kick-in too fast it is becoming very distracting to my workflow and 15 minutes seem to be not too short to my taste.
    Message was edited by: Daniel Goyette

    Well it seem nobody want to give to me any feedbacks or my question in not asked in a good way.
    Message was edited by: Daniel Goyette

  • Do the new iPod Touches shoot video and take pictures?

    Do the new iPod Touches shoot video and take pictures?
    The new Nanos shoot video. You'd think the Touch would.
    I spent maybe 20 minutes reading Apple info pages, an iPod comparison page, and even quickly searched the User Guide, but saw nothing about shooting video anywhere.
    Sure, it talked about video, but it wasn't clear to me if that was only for playback.
    I guess I am missing it, or else it doesn't do it, which would be strange.
    If it does, where is this info on the Apple Web site? That is, links to both video and photo shooting?
    Thanks!
    S.

    not yet....
    most people expected a camera to be added to the iPod touch, but that announcement didn't arrive.

  • Solid amber flashes green once about every minute + even more problems

    I have a problem with my airport express:
    -Even after doing a factory reset my airport express has an solid amber light wich flashes green once about every minute.
    - Sometimes the LED light even goes off for a couple of seconds.
    - I can't find the airport express in the airport express utility, even when I directly connect a LAN cable it won't find it.
    - I also can't find the airport express wirelessly.
    Please help me fixing this airport express.

    Lauren, welcome to the discussions!
    Unfortunately, the symptoms you are describing likely indicate that your Express has an internal problem and may need to be replaced.
    If you have not already done so, try a Factory Default Reset to see if that might help.
    Power down the Express and wait a few minutes.
    Then hold in the reset button and keep holding it in as you plug the device back in to power
    Keep holding the reset button until you see the amber light begin to blink more quickly. This normally takes about 5-10 seconds
    See if that helps. If no luck, I'm afraid the Express has failed and will need to be replaced.

  • I cannot take pictures with my webcam anymore on Facebook. It works with Internet Explorer though :|

    In facebook there's the option to take pictures using your webcam directly on their site. It worked perfectly untill April or so when it stopped recognizing the device. Everything is up to date...so what could be the problem?
    == This happened ==
    Every time Firefox opened
    == in April

    Check the settings: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html

  • Photo Booth Screen Blank, Won't Take Pictures

    Every time I open Photo Booth, I get a blank screen with a little movie symbol and a line through it. It won't let me take pictures at all; all I can do is view the ones I've already taken. All I can find in the help section is that if your screen is blank, the digital video camera isn't hooked up. But I have no idea what that means; I've never had to install anything for it to work. I'm so confused.
    Message was edited by: rogue416

    HI,
    Reinstall the PhotoBooth application from your Mac install disk.
    Insert your Mac install disk. Open the Optional Installs folder, then open Optional Installs.mpkg
    An Installer will start... click Continue. When you get to the Installation Type in the window on the right you will see: Applications. Click the Disclosure triangle so it faces down. Select the PhotoBooth app then click: Continue.
    After all software updates or installations, repair disk permissions.
    Quit any open applications/programs. Launch Disk Utility. (Applications/Utilities) Select MacintoshHD in the panel on the left, select the FirstAid tab. Click: Repair Disk Permissions. When it's finished from the Menu Bar, Quit Disk Utility and restart your Mac. If you see a long list of "messages" in the permissions window, it's ok. That can be ignored. As long as you see, "Permissions Repair Complete" when it's finished... you're done. Quit Disk Utility and restart your Mac.
    Carolyn

Maybe you are looking for

  • Can Adobe Premiere CC 2014 be Installed as a Stand-Alone Upgrade?

    Can Adobe Premiere CC 2014 be Installed as a Stand-Alone Upgrade without having to conflict with an Adobe CC suite on a given machine?

  • Equity Futures-Accounting

    Hi Exprerts Can anybody list flow of accounting entries for equity futures (sap standard process) I pass following entries at first stage Statistical GL  Dr/Cr Busienss Partner  Cr/Dr On maturity , how to reverse this entry. Whether to enter opposite

  • PI installed on BI

    The PI 2004_1_470 patches are installed on EPS/in and uploaded in SPAM for Business Information Warehouse 3.10 system. As it is useless to have PI on BI I have removed the EPS files (CSN.PAT and CSN.ATT) in the EPS/in directory, but the PI is still a

  • Migrating planning artifacts from 11.1.3.3 to 11.1.2.2.

    Hi, I am migration planning application from 11.1.3.3 to 11.1.2.2 . I am trying to use LCM to migrate the artifact using shared service but while importing all the components are grayed out. Can you please let me know how to migrate artifacts from 11

  • Automator to move shared files

    I am using OS X 10.7.3 and shared files with OSX 10.7.3 server.  I want to use automator to identify certain files in a shared folder and move them to another shared folder.  I tried this on my non-server 10.7.3 with files on the HD and it works fine