• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shutdown script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shutdown script


  • Subject: Re: Shutdown script
  • From: Graff <email@hidden>
  • Date: Mon, 17 May 2004 03:37:03 -0400

Hmm, it works fine for me.

Try this version:
<http://developer.apple.com/documentation/MacOSX/Conceptual/ BPSystemStartup/Tasks/CustomLogin.html>

The "#!/bin/sh..." is a shell script that the login hook would call when a user logs out. In the shell script you can place your AppleScript, running the AppleScript through the shell tool osascript. To run an AppleScript with osascript you can pass each line to the command through the -e flag. So this shell script:
----
#!/bin/sh

/usr/bin/osascript -e 'tell application "Finder"' \
-e 'display dialog "script ran"' \
-e 'end tell'
----

The backslashes are there to indicate to the shell that the command is continued on the next line. This shell script runs the AppleScript:
----
tell application "Finder"
display dialog "script ran"
end tell'
----

Obviously you would want to use a different AppleScript script that would do a backup.

- Ken

On May 17, 2004, at 2:09 AM, Bernard Azancot wrote:

Thank you Ken.

The problem is that the link is leading to a "Page not found" . Thus I do not really understand how to use this beautiful "#!/bin/sh*`@#:!~" script. ;-))

Art is something difficult.

Yours.
Bernard


Le 17 mai 04, ` 07:00, email@hidden a icrit :

Date: Sun, 16 May 2004 15:13:52 -0400
From: Graff <email@hidden>
Subject: Re: Shutdown script
To: AppleScript <email@hidden>

You can customize the logout with the instructions on this web page:
<http://developer.apple.com/documentation/MacOSX/Conceptual/
BPSystemStartup/Tasks/CustomLogin.html#//apple_ref/doc/uid/20002134/
BAJCGEGG>

It's kind of hairy because this is for logouts, not for shutdowns.
What I would do is create a script that, when called, checks if there
is only one user logged in and if there is then runs the backup for
that user since the only user is logging out. It's probably easiest to
wrap this in a shell script, in this fashion:
----
#!/bin/sh

/usr/bin/osascript -e 'tell application "Finder"' \
-e 'display dialog "script ran"'\
-e 'end tell'
----

- Ken

On May 16, 2004, at 9:24 AM, Bernard Azancot wrote:

Under MacOS 9, it was easy to perform a backup script when shuting
down the Mac (script in the specific folder inside the System folder
).

How could you do under MaOS X ?

I have found the iBeeZz utility that allows it, but is there a simpler
straightforward mean to do it.
Thanks for your help.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Shutdown script (From: Bernard Azancot <email@hidden>)

  • Prev by Date: Is it possible to register an AS app as a custom URL handler?
  • Next by Date: Re: Is it possible to register an AS app as a custom URL handler?
  • Previous by thread: Re: Shutdown script
  • Next by thread: Re: Shutdown script
  • Index(es):
    • Date
    • Thread