Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Using 'serveradmin' CLI tool to get Mail Info (OS X Server)

Using 'serveradmin' CLI tool to get Mail Info (OS X Server)
Thread Tools
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Mar 12, 2005, 07:54 AM
 
So ultimately, what I'm trying to do is allow PHP to check the mail quota of each mail user. Now normally PHP can just talk to Cyrus directly, but for some reason, the Cyrus with OS X Server has the GetQuota function removed. So what I need to do is use the serveradmin command line tool to get mail quota's for users. Best would be to get info (mailbox size, quota size, etc) for a specified user, but I'd settle for the full table of all user. By full table, and also for an example of wtf I'm talking about...
In the Server Admin.app, click on Mail
Then at the bottom, click on Account
That is the data I need to get from the command line. I've read through the Command Line Administration PDF and didn't find any info on how to do this, yet someone from afp548.com told me that the serveradmin tool can do exactly what I need. Please help if you can, I really need to finish the control panel on this web hosting server. Thanks!
John
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Mar 12, 2005, 04:22 PM
 
You have to love man pages.

Did you know that you can do everything that the Server Admin application does with a web browser? It's not necessarily easy, but you can pull all of the information out in an XML plist type file.

Point your browser at:

https://yourserver:311/

You may be VERY surprised with what you find.

You can use that to figure out what commands to pass to serveradmin. The one you are looking for is:

serveradmin command mail:command = getUserAccounts

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Mar 12, 2005, 04:30 PM
 
Two quick things:
1) Your the man
2) Holy ****!
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Mar 12, 2005, 04:38 PM
 
I had to do some research myself. I already knew about the web access thing because I had just stumbled across it. I was trying to figure out how to increase the timeout in servermgrd when I realized that it was an apache instance, as the config files clearly were apache files. So, just for the hell of it, I opened up a web browser to see. Pretty spiffy, eh?

For your question, I looked in the man page, but the answer wasn't obvious. I remembered the stuff I found earlier and pulled it up. Sure enough, between that and the man page, I had your answer.

Oh, BTW, I never did figure out how to increase the timeout. I was using a B&W G3 as a server/firewall/router. However, I couldn't make any changes to the firewall using Server Admin, because of the timeout--the machine wasn't fast enough to finish in time. I had to make the changes by hand at the command line. Last week, it was replaced with a G4, so I don't need to figure it out any more.

BTW, I posted the answer at afp548 too:

http://www.afp548.com/forum/viewtopi...showtopic=6606
(Last edited by Detrius; Mar 12, 2005 at 04:50 PM. )

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Mar 17, 2005, 09:59 AM
 
I have a Blue G3 as my home server running OS X Server, and i've never had your issue before, it always only takes a few seconds to save changes in server admin. It really doesn't even take longer than it does to save on my Dual 800 Server. I'm thinking you might have other issues with your old server? Like maybe bad permissions so the program COULDN'T write to the config files? I use Webmin for firewall anyway cause I don't like Apple's GUI for that.
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Mar 18, 2005, 06:06 PM
 
Originally posted by l008com:
I have a Blue G3 as my home server running OS X Server, and i've never had your issue before, it always only takes a few seconds to save changes in server admin. It really doesn't even take longer than it does to save on my Dual 800 Server. I'm thinking you might have other issues with your old server? Like maybe bad permissions so the program COULDN'T write to the config files? I use Webmin for firewall anyway cause I don't like Apple's GUI for that.
The only problem I had was with the firewall. I moved the hard drive to the G4 at the office, and changing the firewall settings works fine. When watching the system.log, I could tell that it was timing out. If I deleted the settings and started from scratch, it worked fine until I added enough rules for it to be sufficiently complicated to confuse the machine. Then I couldn't use serveradmin any more to change it. The further evidence to support this is that the exact same OS install (and drive) works fine in the G4. I think it just wasn't fast enough to finalize the transaction before the timeout.

It's kind of a moot point now, though, since I'm using the G4 and not having any problems.

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Mar 18, 2005, 06:12 PM
 
You must have had a ton of rules??!?

Hey, are you also good with /etc/sudoers ?
I've been trying to make it so 'www' (and only www) can run this command (and only this version of the command, only the get mail account info arguments) as root, without a password, so I can have PHP run it. But sudo keeps complaining about any changes I make to /etc/sudoers Any ideas?
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Mar 19, 2005, 08:44 AM
 
Originally posted by l008com:
You must have had a ton of rules??!?

Hey, are you also good with /etc/sudoers ?
I've been trying to make it so 'www' (and only www) can run this command (and only this version of the command, only the get mail account info arguments) as root, without a password, so I can have PHP run it. But sudo keeps complaining about any changes I make to /etc/sudoers Any ideas?
Yes, the machine had three ethernet interfaces. I had to set up what each interface could and could not access on the other interfaces. The G3 could handle the traffic properly if the rules were set up, though.

I've never messed with sudoers, so I couldn't even begin to think that I could give you better advice than the man page. (man sudoers).

BTW, are you familiar with the Web Mail feature built into OS X Server? It's rather simple to set up--and it doesn't require mucking with the sudoers file.

Also, you may want to start a new thread for this.

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
Mac Elite
Join Date: Oct 2000
Location: Seattle
Status: Offline
Reply With Quote
Mar 20, 2005, 07:22 AM
 
Both squirrel mail and cyr-webadm can access the quota from cyrus. They are written in PHP, you could have a look at the code.

cyr-webadm in particular has the quota stuff in an object and can set it as well as get it. I don't think it uses the built in php cyrus stuff. It might give you some ideas anyway.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Apr 17, 2005, 09:53 PM
 
Originally Posted by Detrius
Yes, the machine had three ethernet interfaces. I had to set up what each interface could and could not access on the other interfaces. The G3 could handle the traffic properly if the rules were set up, though.

I've never messed with sudoers, so I couldn't even begin to think that I could give you better advice than the man page. (man sudoers).

BTW, are you familiar with the Web Mail feature built into OS X Server? It's rather simple to set up--and it doesn't require mucking with the sudoers file.

Also, you may want to start a new thread for this.
Hey
I was playing with port 311 but I'm still confused on how it works. So I'm hoping you can help me. I'm making a backup script, and I want to get .plist files for the server settings. The files im talking about are the things you can drag out of the 'settings' tab of the server admin app. I want to get these files from the command line and include them in my .tar backup. Doable?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 04:51 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2