|
|
Starting/stopping services from the command line
|
|
|
|
Mac Elite
Join Date: Feb 2002
Status:
Offline
|
|
Is there a way to start stop services from the commmand line in a format similar to Red Hat?
For instance:
service network stop
(stops the network)
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status:
Offline
|
|
Originally Posted by Tyler McAdams
Is there a way to start stop services from the commmand line in a format similar to Red Hat?
For instance:
service network stop
(stops the network)
Funny you mention it, because there is a "service" command on Mac OS X. It's a pretty simple command with hardly any documentation, but it works similarly to what you described (though I've never used Red Hat extensively). Check out the services it can control with sudo service --list.
The syntax is intuitive for stopping and starting and the man page details one or two other possible switches, for example:
Code:
[root@thefro: ~]# service --test-if-configured-on telnet
[root@thefro: ~]# echo $?
1
Eh, check it out.
|
"In Nomine Patris, Et Fili, Et Spiritus Sancti"
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2002
Status:
Offline
|
|
Thanks! Will do. Other than that, is there a "standard" way that OS X Server admin are taught to start/stop things like nfs, smb... etc from the shell?
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Apr 2001
Location: Asheville, NC
Status:
Offline
|
|
Originally Posted by Tyler McAdams
Thanks! Will do. Other than that, is there a "standard" way that OS X Server admin are taught to start/stop things like nfs, smb... etc from the shell?
sudo serveradmin start smb
see:
man serveradmin
Doesn't work on client, though.
|
ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status:
Offline
|
|
Originally Posted by Detrius
sudo serveradmin start smb
see:
man serveradmin
Doesn't work on client, though.
Plus, the serveradmin command was pretty unintuitive the few times I tried to use it to control the firewall or afp. It seems like every time I try to use it the syntax varies so much from command to command (ipfilter, web, etc)... I wish managing services in Mac OS X server was more like in a Linux system with /etc/init.d scripts for starting, stopping, and restarting services.
Hell, a little shell script with some functions would be better. I didn't ever realize it, but that's all the StartupItems in Mac OS X were... Take this one I wrote for the syslog-ng daemon on one of my Mac OS X servers (Panther):
Code:
[root@server: /Library/StartupItems/syslog-ng]# cat syslog-ng
#!/bin/sh
##
# syslog-ng logging daemon
##
. /etc/rc.common
StartService ()
{
ConsoleMessage "Starting syslog-ng"
/usr/local/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf -p /var/run/syslog-ng.pid
}
StopService ()
{
ConsoleMessage "Stopping syslog-ng"
kill `cat /var/run/syslog-ng.pid`
}
RestartService ()
{
ConsoleMessage "Restarting syslog-ng"
StopService
StartService
}
RunService "$1"
I just wish the serveradmin command was a little easier to use/understand.
|
"In Nomine Patris, Et Fili, Et Spiritus Sancti"
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Apr 2001
Location: Asheville, NC
Status:
Offline
|
|
Originally Posted by [APi]TheMan
...I just wish the serveradmin command was a little easier to use/understand.
I never used the command line version. If I needed to control a server from another machine, I installed the Server Admin Tools on that other machine. As I recall, it's a free download from Apple.
|
ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status:
Offline
|
|
Originally Posted by Detrius
I never used the command line version. If I needed to control a server from another machine, I installed the Server Admin Tools on that other machine. As I recall, it's a free download from Apple.
Haha, totally true. I just get such a kick out of the command line. Plus, Apple's GUI tools can only do so much. I've noticed they're limited when it comes to configuring Apache and the Firewall, for instance.
|
"In Nomine Patris, Et Fili, Et Spiritus Sancti"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|