Shutdown with AppleScript in Lion stop working fine

Hello to everyone,
I have to run this AppleScript (saved as Application.app)
do shell script "sudo shutdown -r now"
With Snow Leopard this script works fine, but now Lion save the application state before shutting down the system, so this application (that is running while the system i shutting down) is automatically restarted at startup.
I also tried to modify it in:
do shell script "sudo shutdown -r +1 &"
tell application "Application"
  quit
end tell
but if I quit the script (Application.app) the shutdown command is stopped.
Can anyone help me in solving this problem, please? I don't know how to do.. Is there a shutdown parameter (via command line) for telling the system to not save the application state?
Thanks very much!
I hope to find an "illuminated" programmer that can help me..
Andrea

Hi "twtwtw" and thanks for you interesting in my problem.. sorry for my bad english; well.. 'illuminated' is not the world I want
I also does not have correctly explained my problem, sorry.. I'll try to do it better.
I use ChronoSync to sync some folder between my iMac (where it's installed on) and my MacBook Pro.. after the syncronization I have to possibility to run an application; the application is the following applescript (saved as .app):
set isConnected to false
try
          set reply to do shell script "ping -c 3 -q MacBook-Pro.local | grep received"
          if reply contains "received" then
                    set theCount to (item 4 of (every word of reply)) as integer
                    if theCount > 0 then set isConnected to true
          end if
end try
if isConnected then
          do shell script "ssh [email protected] 'sudo shutdown -h now'"
end if
delay 60
do shell script "sudo shutdown -r now"
This script test if my MacBook Pro is available on my network and (if yes) shutdown it.
Then wait 60 seconds and shutdown the iMac. I need to use the "do shell script" because my iMac is in the logon screen when the application/script run.. so the script 'tell application "app" to quit' does not work.
Then.. the application that I have to quit is the same application tha run the shutdown command, so I can't quit it before running the shutdown.
My goal is to build a script that could shutdown my local system (even if it runs while my user account is locked and I see on the monitor the logon screen) and that will not restart automatically after the reboot (caused by the application state saved by Lion).
I hope to have explained better my problem
Sorry again for my english.. and thanks for every suggestion that you could tell me!
Andrea

Similar Messages

  • The keyboard on my Mac Pro Server with OS X Lion stopped working

    I'm from Brazil and apple doesn't have any support here, just for iphones...So could anyone please help me?
    The keyboard and the mouse on my Mac Pro suddenly stopped working, the mouse light is on but not working, the mouse cursor doesn't even appear on the screen, I've tryed with different keyboards in all the usb ports and nothing, none of them worked.

    It is a easy fix to this problem.
    I have this video card
    iMac 24 inch, early 2008.
    Graphics card: ATI Radeon HD 2600 Pro 256 MB .
    This is what you do.
    1. open app store.
    2.go to  the update tab.
    Yuo will see the imovie icon waiting to install.
    3.clic the sub menu tab and select "try apdate in an hour" option from the sub menu.
    4.leave the app store window open and came back in an  1hr .
    Like magic you will see the imovie app being upgrade it in the lunch pad .
    enjoy it.

  • So I was updating my boyfriend's iPAD and while updating it stopped and gave me a typical error message but with error 4013. It worked fine before and is now stuck in the "connect to itunes mode" recovery mode. I have tried updating and no luck. I have ev

    So I was updating  iPAD and while updating it stopped and gave me a typical error message but with error 4013. It worked fine before and is now stuck in the "connect to itunes mode" recovery mode. I have tried updating and no luck. I have even tried updating in DFU mode and no luck. Anyone git any solutions

    Are you following these instructions?
    Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to shut down.
    While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    Continue holding the Home button until you see the Connect to iTunes screen.
    iTunes will alert you that it has detected a device in recovery mode. Click OK, and then restore the device.

  • SharePoint 2013 List View with query string filter stops working after editing view from browser

    I have created one list definition in which I have added one list view which will filter data from query string paramater
    So when I am creating list from my list definition, view with query string filter is working fine.
    But when I am modifying view from UI(I am not changing any thing , just opening "Modify View" page and then click on "Save" button), view gets stop working means it's not filtering data based on query string
    Any suggestion what I am missing?
    Below is my list view schema
    <View BaseViewID="11" Type="HTML" TabularView="FALSE" WebPartZoneID="Main" DisplayName="$Resources:OIPLBScoreCard,viewFilterTasksByTarget;" MobileView="True" MobileDefaultView="False" Url="FilteredTasks.aspx" SetupPath="pages\viewpage.aspx" DefaultView="FALSE" ImageUrl="/_layouts/15/images/issuelst.png?rev=23">
    <Toolbar Type="Standard" />
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    <ParameterBinding Name="TargetId" Location="QueryString(TargetId)" />
    </ParameterBindings>
    <JSLink>hierarchytaskslist.js</JSLink>
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink>clienttemplates.js</JSLink>
    <RowLimit Paged="TRUE">100</RowLimit>
    <ViewFields>
    <FieldRef Name="Body"></FieldRef>
    <FieldRef Name="Title"></FieldRef>
    <FieldRef Name="StartDate"></FieldRef>
    <FieldRef Name="DueDate"></FieldRef>
    </ViewFields>
    <ViewData>
    <FieldRef Name="PercentComplete" Type="StrikeThroughPercentComplete"></FieldRef>
    <FieldRef Name="DueDate" Type="TimelineDueDate"></FieldRef>
    </ViewData>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name="oipscTargetLookup" LookupId="TRUE"/>
    <Value Type="Lookup">{TargetId}</Value>
    </Eq>
    </Where>
    </Query>
    </View>
    I have one lookup field from "Target List" in my source list and I want to filter data based on that lookup field.

    Hi JayJT,
    The Miscellaneous is located in the contact list that you used for the connection.
    So , you need to edit the page, then edit the contact list that you used, in the web part properties of the contact list, you will find Miscellaneous, then expand it and select ‘Server Render’ .
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • I have a problem with my iPhone 5 stopped working the sleep / power and simultaneously refused to obey the HOME button. I can not use either one or the other. I can not enable or disable the device, display lights up when you plug the charger. same displa

    I have a problem with my iPhone 5 stopped working the sleep / power and simultaneously refused to obey the HOME button. I can not use either one or the other. I can not enable or disable the device, display lights up when you plug the charger. same display works fine as it is surprising. or maybe someone knows what is the reason for this? is there any way to solve this problem?

    More than likely its a hardware issue, I have never encountered such a problem and best bet is to just go get it replaced. If you have insurance on your device apple will replace it as long as there was no water damage, if you dont have insurance they will charge $200 more or less. Hope you get it fixed

  • Streaming problems with MacBook Pro, iPhone 5 works fine

    If I try to listen music via airplay from iTunes (Mac Book Pro 2009) it stops every 20 seconds for 2-5 seconds and then continue. It is impossible to listen music like that. If I do the same with my iPhone 5, everythink works fine for hours. I am sitting 1m away from the router (Fritzbox 7270) an the router is 1m away from Apple TV. So do anybody know what the reason could be? Thanks a lot!

    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment.

  • Hello. I've Apple TV 3rd gen and MacBook Pro 2013 all with latest updates. AirPlay works fine till I don't start streaming videos from YouTube. After that AirPlay icon from MacBook menu bar simply disappears. Could some help. I'm using 2 Mbps Internet

    Hello. I've Apple TV 3rd gen and MacBook Pro 2013 all with latest updates. AirPlay works fine till I don't start streaming videos from YouTube. After that AirPlay icon from MacBook menu bar simply disappears. Could some help. I'm using 2 Mbps internet connection.

    Same issue here- I can airplay my amazon prime library just fine from my iphone 5 but on my macbook- (mavericks, 15 inch 2013 retina with quad core i7, nvidia 650 M and SSD) it just sputters and lags.
    I have noticed web video is considerably worse than local content, giving me pauses of up to 2 or 3 seconds in which video stops but audio continues in the amazon player. Youku video, however, seems relatively stable. Our subscription speed is 25 mbps, so that should be plenty to stream SD video from Amazon and doesn't account for why it would be nice and stable from the iphone, but not the mbp.
    Playing light, locally hosted steam sidescrollers  like Limbo is better but gives periodic drops in framerate on the Tv. when mirroring the framerate remains steady on the MBP screen.
    Games airplayed from my iphone seem relatively stable, though with a noticably lower framerate on the TV than on the phone.
    It seems these issues have abated considerably since yesterday's Apple TV update, but are still curious nonetheless and I'm not sure that the update yesterday was specifically meant to address those issues or if I'm just getting a time with less network interference now.
    Comcast recently installed a new router/modem/phone combo, replacing our old separate modem and router setup. I'm going to test if putting the network on a different channel helps.

  • TS3899 Cannot send email with new iPad air.  Works fine with old iPad and iPhone.

    Cannot send email with new iPad air.  Works fine with old iPad and iPhone.  I have deleted account and reinstalled.

    Thanks.  I got the problem fixed.  Spent time with the Apple folks and was kicked up to a senior advisor.  It seems the problem was with my internet provider - Tmie Warner.  Remember I could use the old ipad and the iphone to send mail.  I checked all the specifics between the three units.  It seems that TW is changing over from the RR.com  to TWC.com.  Since the new ipad air was just set up, it fell under the new TWC mail specifics. 

  • Hi. I have set up the trial versions of Photoshop CC 2014 and Lightroom 5.6 (ie the Photography plan) on a desktop that I have added a new drive to with Windows 7. Everything works fine BUT it is an old computer and I'm thinking that it may pack up unexpe

    Hi. I have set up the trial versions of Photoshop CC 2014 and Lightroom 5.6 (ie the Photography plan) on a desktop that I have added a new drive to with Windows 7. Everything works fine BUT it is an old computer and I'm thinking that it may pack up unexpectedly. These things happen. I want to sign up for the Photography plan but I also have a Windows Vista laptop, and that is old too so I may want to put the apps on a new desktop and a new laptop, having already installed on my desktop. That makes three activations. Am I allowed to do this? Cheers. Paul

    You cannot have three activations. It's simply not technically possible. If and when the time comes, you simply deactivate/ sign out on one of the old systems and install on the new one. If the system goes belly up, you contact support to reset your account. No need to make it more complicated than that and overthink it.
    Mylenium

  • I'm not able to access goolge docs with the blackberry browser (it worked fine till a few weeks ago)

    I'm not able to access google docs with the blackberry browser (it worked fine till a few weeks ago)
    seems that this issue happens to a lot of people
    is google going head to head with Blackberry ? or is this just a bug ? 
    Message Edited by avolcoff on 08-27-2009 01:06 AM

    Welcme to the cmmunity supprt frums
    Nurse-Berry
    Follow NurseBerry08 on Twitter

  • For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    For unknown reasons iTunes will no longer open.  I have an HP laptop running windows 7 with Kaspersky protection.  It worked fine before but now won't open.  I tried downloading the most recent up-date and it will still not open.  Any suggestions?

    thrillhousecody
    Thanks for the reply with additional information.
    Recent history for Premiere Elements points to the program having problems when more than 1 video card/graphics card is
    being used by the computer on which Premiere Elements is running. This observation may seem contra indicated by the fact
    that you say that the program did work well about 2 years ago in the same setup. But other factors may have set in with regard
    to drivers, drivers versions, and driver conflicts. But this factor, does need to be ruled in or out.
    Can you disable one or the other card to determine the impact of this on your problem?
    But, of prime concern with regard to video card/graphics card is the use of a NVIDIA GeForce card with Premiere Elements 10.
    Even if your NVIDIA GeForce were the only card, Premiere Elements 10 will not work properly unless the NVIDIA GeForce driver
    version is rolled back to about May 2013. This may be one of the major factors here.
    a. Device Manager/Display Adapters and find out Driver Version and Driver Date
    b. Read the background information for the Premiere Elements 10/NVIDIA GeForce issue
    ATR Premiere Elements Troubleshooting: PE10: NVIDIA Video Card Driver Roll Back
    Also see the Announcement at the top of this forum regarding the matter - also with full details of the situation and how to fix with the
    driver version roll back.
    Please review and consider and then we can decide what next.
    Thanks.
    ATR
    Add On...This NVIDIA GeForce situation is specific for Premiere Elements 10. You should not expect to see the problem for
    later versions of Premiere Elements.

  • When I upgraded my iMac to Lion I can no longer connect the iPad 2 to WiFi.  It gives me a message unable to search for WiFi.  Before the upgrade to Lion it worked fine.  What gives?

    When I upgraded my iMac to Lion I can no longer connect the iPad 2 to WiFi.  It gives me a message unable to search for WiFi.  Before the upgrade to Lion it worked fine.  What gives?

    Could there be a setting I need to adjust in the iPad2?  When I try to turn on WiFi and enter the name of the WiFi that I have established, including the security type and the password, I get the message "Could not scan for wireless networks."  Is there a setting in iCloud or other location that needs to be changed?

  • Hi! I am having a problem with my dictation. It works fine with Greek but it does not work at all with English. Anyone knows why?

    hi! I am having a problem with my dictation. It works fine with Greek but it does not work at all with English. Anyone knows why?

    Have you changed the system voice to an English one in system preferences?

  • Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    If you think you're insane now, try maintaining those pop up menus.
    As far as I know, these menus have not been updated since FW 8, so 
    they are at least two versions old.
    Save yourself a lot of grief by avoiding those menus. There are many 
    other products on the market which do a much better job of creating 
    and maintaining this type of navigation structure.
    Read this link before you climb any higher on this slippery slope:
    http://apptools.com/rants/jsmenu.php
    There was another blog post by the fellow who originally wrote the pop 
    up menu feature, but I can't seem to locate it. Even he says stay away 
    from them.
    Not the answer you probably want, but I hope it helps, nonetheless.
    Jim Babbage

  • Cannot convert webpages to pdf using Acrobat X Pro with IE9 and Windows 7, worked fine until a few m

    Cannot convert webpages to pdf using Acrobat X Pro with IE9 and Windows 7, worked fine until a few months and updates ago

    I tried your suggestion, not knowing that the direct pdf printer would also "save as" PDF, but when I try your suggestion and use the Adobe PDF printer that is a direct creation of the PDF from the browser (IE9), instead of the "black out" areas I get when I use the "Convert to" button, I get missing blocks of the resulting PDF, and only get the first 1/4 to 1/3 of the webpage.
    Just to clarify, when I said I print the webpage and then scan, that is a work around I have to do if I need a scanned version of the way a webpage appears on a particular date and time, instead of the one step process I used to be able to do when Adobe Acrobat would actually convert the webpage to a pdf without blackout areas or, if I try your suggestion, blank spots with a partial webpage. But the idea was one I had not thought of and I appreciated the thought.
    Yes, Acrobat was updated, and is updated, and was working fine until a few months ago, Win 7 and Office 32 bit versions, Office 2010

Maybe you are looking for