Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Easy AFP Reset' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easy AFP Reset
Authored by: jkemp on Dec 11, '01 03:32:08PM
This small script will automagically reset the AFP server for you. Just type it into a text file using pico or your favorite editor, and save it as something like resetafp. Change it to be executable by you (chmod 700). You must either be root or use sudo to run it, as AppleFileServer is a root daemon.

Alternatively, you could add the sudo command at the beginning of the two command lines in the script if you don't want to have to type it every time you reset. :-)


#!/bin/sh
kill -9 `ps x | grep AppleFileServer | awk '{print $1}'`
nohup /usr/sbin/AppleFileServer &


[ Reply to This | # ]
Easy AFP Reset
Authored by: scot on Nov 27, '02 10:05:20PM
You work too hard, just use the .pid file...

sudo kill -HUP `cat /var/run/AppleFileServer.pid`

[ Reply to This | # ]
Easy AFP Reset
Authored by: sbbeachvball on Sep 30, '05 04:33:34PM

A HUP signal seemed to work for me. So this one liner should work.
Running the grep in the backticks often finds itself, so the grep -v grep
excludes it from the results...

kill -HUP `ps x | grep AppleFileServer | grep -v grep | awk '{print $1}'`

---
Aaron Martin
CNT Crustal Studies, UCSB



[ Reply to This | # ]
Easy AFP Reset
Authored by: sbbeachvball on Sep 30, '05 04:38:08PM

Ooops, didn't notice the first reply.
Didn't know about the pid file for AppleFileServer, definitely better to use that....

---
Aaron Martin
CNT Crustal Studies, UCSB



[ Reply to This | # ]