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)
-   -   Script Help (https://www.shirt-pocket.com/forums/showthread.php?t=1988)

shorton 01-07-2007 10:03 PM

Script Help
 
:confused: I would like SuperDuper to run a script that reboots my computer from the same startup disk that it is currently running from after completion.

I know nothing about shell scripting.

Anyone?

TIA,
Scott

(My attempts to run a compile applescript have failed due to permissions problems, although I thought the permissions were fine.) The log reads: Error | sh: line 1: /Users/Shared/Restart.scpt: Permission denied

dnanian 01-07-2007 10:13 PM

Any particular reason why you want to do that, Scott?

shorton 01-07-2007 10:20 PM

Script Help
 
Yes.

This is a shared computer at our church. It boots itself every Sunday AM very early. SD runs as 'root' a few minutes after boot up. I could shut down the computer, but it is more convenient to have it up and running for either remote access early, or for the tech crew who comes in a couple hours later.

However, when using SD like this, the system administrator is logged in despite the MacOSX login window being visible. This could present problems.

So, if the computer where to reboot from the same startup disk after completion, then all would be OK.

dnanian 01-07-2007 10:23 PM

OK. Try putting this in a text file:

Code:

#!/bin/sh
shutdown -r  +1

Once that's saved, then -- in Terminal, run:

Code:

chmod +x the-file-you-saved
Then, set that as the "after copy" script, and you should be all set: it'll shut down one minute after the copy is complete.

shorton 01-07-2007 10:32 PM

Script Help
 
Actually, I want the computer to reboot, not shutdown. For a shutdown, couldn't I just do that via the SD interface itself?

Also, I tried something similar with terminal but got myself confused (novice here.) I saved code in TextEdit, then opened Terminal and did the chmod +x, hit return, and then dragged the saved file into terminal to set the path.

However, does this do something to the text file itself? Or, do I have to save the terminal as something?

Sorry for being so numb.

scott

shorton 01-07-2007 10:48 PM

Script Help
 
Well, I tried to make a shell script, but I still really don't know what I am doing. I get the following error (same error when I tried to get SD to run a simple compiled applescript)

......COMMAND => Invoking After Copy shell script: /private/var/root/Desktop/Restart Shell Text.rtf
| 10:46:11 PM | Error | sh: line 1: /private/var/root/Desktop/Restart Shell Text.rtf: Permission denied

dnanian 01-08-2007 06:49 AM

Two things. "shutdown -r" does a restart, not a shutdown.

Second, you need to make a plain text file, not an RTF file. And, it looks like you didn't make it executable with the 2nd command provided.

shorton 01-08-2007 08:12 AM

Script Help
 
Again, I apologize for being such a novice, but I really don't know how to make/save an executable.

I rewrote the code and saved as plain text. I opened terminal and typed the code you supplied. I opened terminal and did the chmod command as supplied.

But what is next? Nothing happens. I can save the text file, but it appears to be nothing but text. Do I save a terminal document instead? What kind? etc.?

Sorry, but I guess I need hand holding and precise click by click instructions.

Here is the log from my latest try.

..ACTION: Running shell script restartshellscript.txt
| 08:20:12 AM | Info | ......COMMAND => Invoking After Copy shell script: /private/var/root/Desktop/restartshellscript.txt
| 08:20:12 AM | Info | Copy complete.
However, no restart occured. Waited 3-4 minutes, nothing.

Thanks again,

Scott

dnanian 01-08-2007 08:30 AM

Try running your restartshellscript.txt from the shell itself. The command would be:

Code:

/private/var/root/Desktop/restartshellscript.txt
(Followed by Return, of course.)

shorton 01-12-2007 10:09 PM

Script Help
 
Tried it, nothing happens.

Scott

dnanian 01-12-2007 10:12 PM

Something must be wrong with what you put in the script, then. If you type:

shutdown -r now

in Terminal, does your system reboot?

shorton 01-12-2007 10:20 PM

Script Help
 
Yup, reboots with shutdown -r now in terminal.

the code in the restart script is:

#!/bin/sh
shutdown -r +1

dnanian 01-12-2007 10:21 PM

OK -- let's try that command, too, then, in Terminal:

shutdown -r +1

It should restart after a minute.

shorton 01-12-2007 10:24 PM

Script Help
 
OK, I did and it did restart in 1 minute. I believe that my txt file had 2 spaces between the -r and the +1. When I made certain that there was a single space and typed it directly into terminal, it did restart in 1 minute.

So I modified restartshellscript.txt in a text editor to be sure that there was no double space. However, when I try /private/var/root/Desktop/restartshellscript.txt ; still nothing happens.

dnanian 01-12-2007 10:33 PM

And when you type:

cat /private/var/root/Desktop/restartshellscript.txt

it prints to the Terminal and looks normal?

If you do a:

ls -l /private/var/root/Destktop/restartshellscript.txt

what do you get? (Paste it in here.)


All times are GMT -4. The time now is 11:47 AM.

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