• 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
[OT] Shell scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] Shell scripting


  • Subject: [OT] Shell scripting
  • From: "Marc K. Myers" <email@hidden>
  • Date: Fri, 26 Dec 2003 03:30:55 -0500

For reasons no one seems to understand, file sharing on my OS X 10.2.8 G4 tower (466MHz) keeps turning itself off. This prevents my accessing files from remote locations. I found a script on the web that looked to be the solution. It checks to see if the AppleFileServer process is running and starts it up if it isn't.

#!/bin/sh

. /etc/rc.common
##
# Check AFP Server and restart if necessary
##

RUNNING=`ps auxc | grep AppleFileServer`
if [ "$RUNNING" = "" ]
then
CheckForNetwork
if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
echo "AppleFileServer restarted by autoAfpCheck" >> /private/var/tmp/console.log
AppleFileServer &
fi

Set up as a cron task this works as advertised but it doesn't make file sharing available. I have to bring up the Sharing pane of System Preferences to do that. I don't have to change anything or click anything on the pane. If the pane is already open then changing or clicking anything activates file sharing.

I'm looking for a way to restart file sharing when it turns itself off. (Better still would be a way to keep it from turning itself off!) If this shell script could be augmented to do that it would be great. If it requires UI scripting to diddle the sharing pane I'll have to learn how to do that. (Where can I pick up the software and documentation for UI scripting?)

Being a complete novice at shell scripting I can't figure out how to add the date and time to the message my script sends to the console. Can someone tell me how to do that? Setting a variable to the output of a date command ought to be easy but my references don't tell me how to do it.

Thanks for any help.

Marc [12/26/03 3:28:40 AM]
_______________________________________________
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.

  • Follow-Ups:
    • Re: [OT] Shell scripting
      • From: Gnarlodious <email@hidden>
    • Re: [OT] Shell scripting
      • From: "John W. Baxter" <email@hidden>
  • Prev by Date: Re: Package Maker in Panther
  • Next by Date: DropStuff workaround (was Re: OS X and RegEx Commands)
  • Previous by thread: Re: Scripting a Web-based form
  • Next by thread: Re: [OT] Shell scripting
  • Index(es):
    • Date
    • Thread