|
|
Starting and stopping services
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2006
Status:
Offline
|
|
Is there a way to start and stop various OS X services from the CLI? There are a couple of configuration changes I'd like to make from roam from home to office to where ever. I'm talking about ssh, internet sharing (including switching what gets shared over what), file sharing, etc.
Any tips or pointers? I've haven't dug into this yet, thought I'd ask here first.
I'm an "old school" *ix guy that likes to have control for exactly these types of situations.
Thanks in advance.
|
2GHz MacBook w/2Gb RAM & 120Gb disk
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Dec 1999
Location: New York
Status:
Offline
|
|
Are you sure you need to stop and start those services for changes to take effect? My best guess for restarting services would be to kill the process and then launch it from the terminal.
Maybe you could make an AppleScript script to modify whatever settings you want to change if there is no simple cli method. I'm assuming you are trying to automate changing these settings... I have not tried this myself, so I don't know if it's possible.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2006
Status:
Offline
|
|
Originally Posted by maceye
Are you sure you need to stop and start those services for changes to take effect? My best guess for restarting services would be to kill the process and then launch it from the terminal.
No I'm not sure, but in general this is how things work on other unices. I'm assuming thats the case with OS X as well.
Maybe you could make an AppleScript script to modify whatever settings you want to change if there is no simple cli method. I'm assuming you are trying to automate changing these settings... I have not tried this myself, so I don't know if it's possible.
This is an option, but the CLI method doesn't have to be simple - I grok multiple scripting languages. I'll have to do a bit of research.
|
2GHz MacBook w/2Gb RAM & 120Gb disk
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Dec 2000
Status:
Offline
|
|
The web server can be restarted in the usual manner - "apachectl restart".
Try reading up on launchd, the Mac OS X daemon launcher and manager.
|
|
|
|
|
|
|
|
|
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
General UNIX daemons reload changes if you send HUP to them, ie "sudo kill -1 pid" or "sudo killall -1 process_name". HUP will kill any normal process (that's what they get sent when you log out or close the parent terminal window), but a daemon will just restart.
For an intro to launchd and launchctl, try this
Getting Started with launchd
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2006
Status:
Offline
|
|
Originally Posted by P
General UNIX daemons reload changes if you send HUP to them, ie "sudo kill -1 pid" or "sudo killall -1 process_name". HUP will kill any normal process (that's what they get sent when you log out or close the parent terminal window), but a daemon will just restart.
For an intro to launchd and launchctl, try this
Getting Started with launchd
Very cool - I think this is what I was looking for. Thanks for the pointer. Its actually scary remembering signals after being away from real Unix admin jobs for nearly ten years.
Thanks again and I look forward to hopefully helping other people here.
|
2GHz MacBook w/2Gb RAM & 120Gb disk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|