#16
|
|||
|
|||
Script Help
Here is what I have in a terminal window.
Last login: Fri Jan 12 22:31:33 on ttyp1 Welcome to Darwin! SBC-Sanctuary:~ root# cat /private/var/root/Desktop/restartshellscript.txt SBC-Sanctuary:~ root# cat /private/var/root/Desktop/restartshellscript.txt SBC-Sanctuary:~ root# ls -l /private/var/root/Destktop/restartshellscript.txt ls: /private/var/root/Destktop/restartshellscript.txt: No such file or directory SBC-Sanctuary:~ root# |
#17
|
||||
|
||||
Well... that certainly implies that the file isn't where you indicated it was, isn't named that, etc... do an
ls -l ~/Desktop to see what it's really called.
__________________
--Dave Nanian |
#18
|
|||
|
|||
Script Help
Last login: Mon Jan 15 21:46:47 on console
Welcome to Darwin! SBC-Sanctuary:~ root# ls -l ~/Desktop total 2920 -rw------- 1 root wheel 6148 Jan 12 22:32 .DS_Store -rw------- 1 root wheel 0 Nov 3 2005 .localized -rwxrwxrwx 1 root wheel 1481534 Mar 18 2006 Take Control of Making Music with GarageBand (3.0).pdf -rwxr-xr-x 1 root wheel 25 Jan 12 22:21 restartshellscript.txt SBC-Sanctuary:~ root# |
#19
|
||||
|
||||
ok, so:
cat ~/Desktop/restartshellscript.txt should print it out...
__________________
--Dave Nanian |
#20
|
|||
|
|||
Script Help
I have no printer connected to this printer, so after
cat ~/Desktop/restartshellscript.txt and 'return', nothing seems to happen. |
#21
|
||||
|
||||
No printer needed. If nothing happens, the file is empty.
Let's create this file in Terminal. Note: you cannot make any typing errors here. Type: Code:
cat >~/Desktop/restart.shell #!/bin/sh shutdown -r +1 ^D (that is, Control-d, don't type ^D or this text :)) Code:
chmod +x ~/Desktop/restart.shell Code:
cat ~/Desktop/restart.shell Code:
~/Desktop/restart.shell
__________________
--Dave Nanian |
#22
|
|||
|
|||
Script Help
Progress has been made, thank you.
Doing what you wrote above I was able to get a shell script to restart the Mac. I then ran SuperDuper with the shell script being executed after completion of the backup script. Interestingly, the SD window last step said 'script failed to execute' or some similar error message. However, after one minute the machine rebooted, so obviously it did run indeed. Below is that portion of the SD log. 12:18:42 AM | Info | ...ACTION: Running shell script restart.shell | 12:18:42 AM | Info | ......COMMAND => Invoking After Copy shell script: /private/var/root/Desktop/restart.shell | 12:18:42 AM | Error | shutdown: [pid 259] Anyway, I think that what I wish to accomplish will now work, but am curious about the error. Thank you, Scott |
#23
|
||||
|
||||
I think this is because we got a signal that the system is shutting down. There are ways to fix this, e.g:
Code:
#!/bin/sh nohup /bin/bash -c "sleep 10; shutdown -r +10" &
__________________
--Dave Nanian |
#24
|
|||
|
|||
Script Help
Well, it sounds as if I would have to start over creating the shell script and other than following your recipe, I really don't know what I am doing. However, is there any harm in leaving it the way it is with the error?
|
#25
|
||||
|
||||
Not really...
__________________
--Dave Nanian |
#26
|
|||
|
|||
Script Help
Thank you for your help.
In summary, if I were to re-create the shell script via terminal I would then use the code ------- #!/bin/sh nohup /bin/bash -c "sleep 10; shutdown -r +10" & ------- instead of ------- cat >~/Desktop/restart.shell #!/bin/sh shutdown -r +1 ^D ------- Is this correct? |
#27
|
||||
|
||||
That's rightish (the code goes in the pace of the
#!/bin/sh shutdown -r +1 of course, the other parts actually create the file with the code in it).
__________________
--Dave Nanian |
#28
|
|||
|
|||
Script Help
Well, maybe I spoke to soon. There is another level of complexity here, and got the following error on an autoexecution this AM.
| 05:09:32 AM | Info | ...ACTION: Running shell script restartshellscript.txt | 05:09:32 AM | Info | ......COMMAND => Invoking After Copy shell script: /private/var/root/Desktop/restartshellscript.txt | 05:09:32 AM | Error | sh: line 1: /private/var/root/Desktop/restartshellscript.txt: No such file or directory This machine boots up automatically at 4:55AM Sunday mornings to the log-in screen. Because the root account is running SD, the scheduled execution of the backup did run and SD appears behind the log-in window. However, the restart shell script apparantly could not be found and gave the above error. Would it make any difference if the path to the shell script were in the Shared users directory? Or is this just going to be a problem because of the log-in window screen being where the computer is at? Or would the newly suggested code be better? TIA, Scott |
#29
|
||||
|
||||
You can put it anywhere you want (as long as it's readable by root) -- it just has to be in that location, and it doesn't look like it's where you've indicated it is...
__________________
--Dave Nanian |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Booting from backup | guruuno | General | 27 | 10-16-2009 11:53 PM |
Do shell script erroring? | Budgie | General | 1 | 02-08-2006 04:50 PM |
Scheduled Custom Script Uses Wrong Script? | Dasman | General | 1 | 12-08-2005 01:55 PM |
Error: No space left on device | tradervic | General | 11 | 06-29-2005 04:50 PM |
Error when running SuperDuper via shell script | kbradnam | General | 9 | 03-09-2005 05:12 PM |