ZimbraOsXAutoLauncher StartupItems Script & extras

Ask questions about your setup or get help installing ZCS server (ZD section below).
Post Reply
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by s3nz3x »

this is a followup of this thread:


My">http://www.zimbra.com/forums/showthread.php?t=882
My first script :) Â…

[Working on mac OsX 10.4.3]
Well it took me some timeÂ… And finally made a script to AutoLaunch zimbra @ startup.
I you want to use it: do it at your own risks.

I've not checked security issues yetÂ…and they maybe some regarding your policy as admin
I don't really know how zimbra gets launched on Other Os, but on OsX, @ least, I, have to log in the user zimbra and fire up a terminal window zmcontrol start, to get it launched.

After digging around mostly on Macosxhints.com & Apple.com I have wrote StartupItems.

Now I just power up the Mac and I can go. No need to log in, nor go in the terminal anymoreÂ… ;-) I love this.
ZimbraOsXAutoLauncher StartupItems.
you'll download a.dmg file (140kb) with everything inside :

a folder ZIMBRALAUNCH and inside the script and the StartupParameters.plist file. and a Readme file to install it.
I've put it in

/system/Library/StartupItems/ZIMBRALAUNCH/

/system/Library/StartupItems/ZIMBRALAUNCH/ZIMBRALAUNCH

/system/Library/StartupItems/ZIMBRALAUNCH/StartupParameters.plist
you may put them in :(as root)

/Library/StartupItems/ZIMBRALAUNCH/

/Library/StartupItems/ZIMBRALAUNCH/ZIMBRALAUNCH

/Library/StartupItems/ZIMBRALAUNCH/StartupParameters.plist
then in terminal:

cd /system/Library/StartupItems/ZIMBRALAUNCH/

then

chmod 755 ../*

then

chmod +x /ZIMBRALAUNCH
that's it.

# to check if it's working, get a new terminal window and type :

#

sudo SystemStarter start ZIMBRALAUNCH

#

# You should see some stuff on the screen. no need to interact.

#

# Once its Started type :

#

sudo SystemStarter restart ZIMBRALAUNCH

#

# You should see some stuff on the screen. no need to interact.

# I've noticed that when I invoque 'zmcontrol stop', I've always some error displayingÂ… but that's ok.

# it will continue the script and restart tha whole stuff.

# it should and with :

Host macintosh.zimbratester.org

antispam Running

antivirus Running

ldap Running

logger Running

mailbox Running

mta Running

snmp Running

spell Running

#
Now you can reboot your mac.
Extras :

I've also made 3 executables that I've put in:

/usr/bin/

I named them:

zmautolaunch -> to launch zimbra (aka zmcontrol start)

zmautostop -> to stop zimbra (aka zmcontrol stop)

zmautostatus -> to check status (aka zmcontrol status)
I hear some of you saying what's the point if it's the same as zmcontrol ?
Well the point is 1: the same as the StartupItems,

I don't want to have to log in as zimbra to launch and check, etcÂ…

And

2) as I've put this files in /usr/bin so it is accessible for everyone who knows the scripts are there (you can put it where you like) and you run it as Your user account no need to log in as zimbraÂ… :-).

Now, I'm gonna to reinstall 2 or 3 time zimbra, so I can get sure I know the stuff. What I'm gonna do now that I've this scripts is that I'm gonna make the user zimbra with a UID lower than 501 so that it's gonna be invisible at login. A mac could run zimbra on it and user don't even know that it's on.Â…
for example :

I can check with Apple remote Desktop for instance the status of the zimbra server (zmautostatus). and in case restart it(zmautostop - zmautostart).

I'm gonna do a 4th one for restartfunction.
AS I can upload here a file, I've made a .zip

instead of a .dmg (from the finder).
for those that prefer copy-paste-customise Â…

Next post is the code that works like a charm for me.
AGAIN I ain't no programer it took some hours to get it working.

If anyone as improvmentsÂ… go for it.

I also Have some ideas but as everything works here for me, I'll wait a little to test further.

This is very fresh I've been testing this the half day now and as it works I post here and upload the files.

AGAIN BAckup, bla bla, you're warned.

By the way I've scanned with ClamXAV the .zipÂ… but you can still scan it again on your computer.
s3nz3x
opening my files to cut & paste in the next post right now
ZimbraOsXAutoLauncher-0.1.zip
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by s3nz3x »

For the StartupItems
1st file:

The StartupParameters.plist:
--begining of file StartupParameters.plist ( from next line)



http://www.apple.com/DTDs/PropertyList-1.0.dtd">





Description

ZimbraOsXAutoLauncher

Messages



start

Starting Zimbra

stop

Stopping Zimbra



OrderPreference

Last

Provides



ZIMBRALAUNCH



Requires




Uses



System Log

Resolver

Disks

NETWORK

DNS







-- end of file-- StartupParameters.plist ( to previous line)
2sd file:

the executable:

--begin of file--ZIMBRALAUNCH ( from next line)

#!/bin/sh
##### ZimbraOsXAutoLauncher v0.1

#

# by s3nz3x->I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# ZimbraOsXAutoLauncher: a script to auto launch Zimbra Collaboration Suite at boot.

#

# I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# s3nz3x

#

# The startupitems folder

# d /Library/StartupItems/ZIMBRALaunch/

# f /Library/StartupItems/ZIMBRALaunch/ZIBRALaunch ## this file ;-)

# f /Library/StartupItems/ZIMBRALaunch/StartupParameters.plist

#

##### ZimbraOsXAutoLauncher v0.1
. /etc/rc.common
StartService()

{

if [ "${ZIMBRALAUNCH:=-NO-}" = "-YES-" ]; then

ConsoleMessage "Starting ZIMBRALAUNCH" && echo "Starting ZIMBRALAUNCH" && echo "Starting ldap"

cd /opt/zimbra/bin/ ; sudo su - zimbra -c "ldap start ; zmcontrol start && zmcontrol status"

fi

}
StopService()

{

ConsoleMessage "Stopping ZIMBRALAUNCH" && echo "Stopping ZIMBRALAUNCH"

cd /opt/zimbra/bin/ ; sudo su - zimbra -c "zmcontrol stop"

}
RestartService()

{

ConsoleMessage "Restarting ZIMBRALAUNCH" && echo "Stopping ZIMBRALAUNCH NOW"

cd /opt/zimbra/bin/ ; sudo su - zimbra -c "zmcontrol stop"

ConsoleMessage "Restarting ZIMBRALAUNCH" && echo "Restarting ZIMBRALAUNCH" && echo "ReStarting ldap"

cd /opt/zimbra/bin/ ; sudo su - zimbra -c "ldap start ; zmcontrol start && zmcontrol status"

}
RunService "$1"
--end of file ZIMBRALAUNCH-- (to previous line)
a very small explaination.
I've noticed that (on my box) it's better too first launch ldap and then the other antivirus, mta, spell, etcÂ…
you could remove the part:

ldap start ;

on everylinesÂ… you can test.
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by s3nz3x »

the StartupParameters.plist code doesn't display well.

so you should download the zip file and cut and paste from your mac.
Codes for the functions

zmautolaunch; zmautostop; zmautostatus; zmautorestart (to come);
zmautolaunch:

#!/bin/sh

#

##### ZimbraOsXAutoLauncher v0.1

#

# by s3nz3x->I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# ZimbraOsXAutoLauncher: a script to auto launch Zimbra Collaboration Suite at boot.

#

# AGAIN : I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# s3nz3x

#

# ZimbraOsXAutoLauncher v0.1
cd /opt/zimbra/bin/ ; sudo su - zimbra -c "ldap start && zmcontrol start && zmcontrol status"

--endoffile--zmautolaunch (prevouis line)
zmautostop

--begin of file--

#!/bin/sh

#

##### ZimbraOsXAutoLauncher v0.1

#

# by s3nz3x->I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# ZimbraOsXAutoLauncher: a script to auto launch Zimbra Collaboration Suite at boot.

#

# AGAIN : I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# s3nz3x

#

# ZimbraOsXAutoLauncher v0.1
cd /opt/zimbra/bin/ ; sudo su - zimbra -c "zmcontrol stop"

--end of file--zmautostop
zmautostatus:

--begin of file--

#!/bin/sh

#

##### ZimbraOsXAutoLauncher v0.1

#

# by s3nz3x->I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# ZimbraOsXAutoLauncher: a script to auto launch Zimbra Collaboration Suite at boot.

#

# AGAIN : I'm in NO WAY a programmer. USE THIS AT YOU OWN RISKS.

#

# s3nz3x

#

# ZimbraOsXAutoLauncher v0.1
cd /opt/zimbra/bin/ ; sudo su - zimbra -c "zmcontrol status"

--end of file--zmautostatus
Hope it helps.

todos:

Check if the System could relaunch all this in case of hang up or crash ?

Will (maybe) work on it.
s3nz3x.
I've tested - start stop restart etcÂ…

and meanwhile have successfully tested the connexions with:
Apple Mail.app: (Os X 10.4.1 & 10.4.3)

POP3

POP3s

imap

imaps

smtp

(smtps) -> some errorsÂ…

Exchange account

Microsoft Entourage
Safari can only read but not writeÂ…

Firefox only does the trick with the web browser login.
For the DarkSide:

I've successfully tested with : Microsoft Outlook Express on a W2k-sp4 box.
enjoy
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by s3nz3x »

I'm paranoid:

Just Clone your disc or whatever backup before using this !!

-I'm gonna right now launch CarbonCopyCloner to save this working configuration.

So, Just do soÂ… you're warned.
( even if It works very well for meÂ…)
14319KevinH
Ambassador
Ambassador
Posts: 4558
Joined: Fri Sep 12, 2014 9:52 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by 14319KevinH »

Thanks for looking at this. Before we could use this with Zimbra you'd need to sign a contrib agreement then fax and mail it in.
http://www.zimbra.com/license/contribut ... ement.html
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

ZimbraOsXAutoLauncher StartupItems Script & extras

Post by s3nz3x »

[quote user="14319KevinH"]Thanks for looking at this. Before we could use this with Zimbra you'd need to sign a contrib agreement then fax and mail it in.
http://www.zimbra.com/license/contribut ... ement.html[/QUOTE]

I'm Impressed & honoredÂ…

I've signed the doc and just send by fax.

Regards

s3nz3x
Post Reply