Shirt Pocket Discussions

Shirt Pocket Discussions (https://www.shirt-pocket.com/forums/index.php)
-   General (https://www.shirt-pocket.com/forums/forumdisplay.php?f=6)
-   -   Simple Restart of Mac wanted (https://www.shirt-pocket.com/forums/showthread.php?t=6328)

quattlebaum 11-22-2010 11:11 AM

Simple Restart of Mac wanted
 
My office requires each computer to logout after hours. For security reasons and for their remote update needs.

I like to use SD 2.6.2 every Friday after work to backup my primary HD to a second HD (in my MacPro) on a scheduled basis.

SD has options to Restart from my backup drive and to ShutDown. I simply want to Restart and let the Mac come back to the Login screen.

So I used a simple AppleScript from the web (see below), put it inside the folder I have SD and set SD to execute this script "after copy completes" but get the following error: "| 05:41:03 PM | Error | sh: /Applications/Apps QB/SuperDuper!/restart.scpt: Permission denied"

Here is the script:
tell application "Finder"
restart
end tell
-------------------
1 - it would be nice to have a basic "Restart" option
2 - but what might I be doing wrong with this script? Apple AppleScripts and Shell scripts not the same perhaps?

thanks much!
qb

dnanian 11-22-2010 11:17 AM

That's an AppleScript, not a shell script: you can't just run an AppleScript like that.

The "Shut Down" option in SuperDuper! won't work for you?

quattlebaum 11-22-2010 11:20 AM

NOT Shutdown
 
I don't want to Shutdown - work requires we leave our Mac ON but at the login screen so they can do nightly backups and push updates when needed.

dnanian 11-22-2010 11:24 AM

I see. Well, you can use something like

#!/bin/sh
nohup /bin/bash -c "sleep 20; osascript /path/to/scpt" &

as your shell script, substituting appropriately. This has to be saved to a plain text file with execute (+x) privileges.

quattlebaum 11-22-2010 11:35 AM

Thanks
 
Between your shell script and a shell tutorial from the web I believe this will solve my needs. If not, "I'll be back." :-)

thanks
qb

quattlebaum 11-22-2010 12:48 PM

No Restart... so I'm Baaack...
 
So I created the file "restart.sh" with the following contents and put it inside my SD folder:

#!/bin/sh
nohup /bin/bash -c "sleep 20; osascript /Applications/Apps QB/SuperDuper!/restart.scpt" &

-------
I used chmod as described here to modify "restart.sh":
chmod +x (and drag from finder the script 'remove_cache.sh')

---------
as a reminder "restart.scpt" has the following (and if I "run" this script the computer does restart):


tell application "Finder"
restart
end tell

-------
SD does execute "restart.sh" without any error my MacPro does not restart. Seems to cause the cpus to get utilized for a minute but nothing else.

Does anything need to be "complied"? Sorry for my programming innocence (ignorance!)

qb

dnanian 11-22-2010 01:12 PM

The space in the path of the osascript isn't going to work. You'll need to escape that (and probably the exclamation point, too).

Why not temporarily just put it in /Applications to see if you can get it to work, and change the path to just
/Applications/restart.scpt

quattlebaum 11-22-2010 02:02 PM

Success!
 
You are correct about the space in the path. Once i moved the scrips into /Applications and changed SD to find the .sh all worked find.

Many many thanks!

qb

dnanian 11-22-2010 02:27 PM

Glad to help.


All times are GMT -4. The time now is 05:08 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.