Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bentoms

macrumors regular
Original poster
Mar 23, 2006
118
0
Hi guys, dunno if tis should have been posted here or in the Server forum but here goes nothing!!

I have a UNIX script that fixes a font cache issue that sometimes affects the Macs that I support.

The Script is this;

sudo rm -rf /Library/Caches/com.apple.ATS |
sudo ln -s /private/tmp /Library/Caches/com.apple.ATS |
sudo reboot now

But I think I may have done something wrong a the script doesn't "end."

i.e. it runs as it should, but doesn't terminate to say that's done.

So what have I missed?
 

zmttoxics

macrumors 65816
May 20, 2008
1,020
1
Try this instead:
Code:
#!/bin/bash
rm -rf /Library/Caches/com.apple.ATS 
ln -s /private/tmp /Library/Caches/com.apple.ATS 
reboot

Then run it like this:
Code:
sudo ./file.sh
 

zmttoxics

macrumors 65816
May 20, 2008
1,020
1
If you use && that should work. cmd 1 && cmd 2 &...

Though, I now realize this is ARD specific (early morning today :p) so that may not work as its actually the bash method.
 

chocodup

macrumors member
May 17, 2008
34
3
I am not sure about the shell version you need to use.

In Bourne/Korn shell :
- the "cmd1 ; cmd2" command line launches cmd2 after cmd1 complete execution (=serial processes)
- the "cmd1 & cmd2" command line launches both cmd1 and cmd2 at the same time (= parallel execution)

In C shell, I am not sure there is a parallel execution syntax, but the serial one is the same as for Bourne/Korn shell.

=> try the ';' separator between your commands, you can use the '\' character if you want to have multiple lines :
Code:
cmd1;\
cmd2;\
cmd3
 

zmttoxics

macrumors 65816
May 20, 2008
1,020
1
I am not sure about the shell version you need to use.

In Bourne/Korn shell :
- the "cmd1 ; cmd2" command line launches cmd2 after cmd1 complete execution (=serial processes)
- the "cmd1 & cmd2" command line launches both cmd1 and cmd2 at the same time (= parallel execution)

In C shell, I am not sure there is a parallel execution syntax, but the serial one is the same as for Bourne/Korn shell.

=> try the ';' separator between your commands, you can use the '\' character if you want to have multiple lines :
Code:
cmd1;\
cmd2;\
cmd3

Sorry champ, but a '&' is run the process in the back ground. While '&&' is sequential launching. Bash and KSH do not support parallel launching.
 

foidulus

macrumors 6502a
Jan 15, 2007
904
1
I would try the reboot as a separate task

I haven't had very much luck doing reboots via the command line, esp. on macs that got into a stupid state.

I would just run the first two commands, then do another reboot command using ARDs reboot.
 

yellow

Moderator emeritus
Oct 21, 2003
16,018
6
Portland, OR
Another issue...

Do not use sudo. Sudo expects a password interaction within the shell.

Simple do the command and leave sudo out, and then choose the Run Command as and enter root as the user.

This is probably why nothing is working.
 

bentoms

macrumors regular
Original poster
Mar 23, 2006
118
0
thanks for the replies guys.

I think that as I'm asking it to reboot it's not giving ARD a proper exit, so does not appear to be terminating.

As soon as another Mac has the issue i'll try the above & let you know what happens.

I have a feeling that just typing the commands & hitting return at the end if each line should be ok. It's probably just the GUI throwing me.

Oh & I forgot to remove the sudo, I will be rubbing this as root.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.