Linux/Mac – Have Margarita Startup Automatically On Boot

A little introduction.

Greg Neagle put together a wonderful third party Apple Software Update Service (SUS) called Reposado. In short, the top three greatest features Reposado offers are the ability to create separate update branches, the ability to offer deprecated updates, and it does not need to be run on Mac OS X hardware.

Reposado is great and if you’re using Apple’s SUS solution I recommend you switch. Reposado does have one drawback though, it’s command line only. While that isn’t a problem for most administrators, there may be times when you want someone else, who doesn’t feel comfortable at the command line, to manage updates. Or, perhaps you want the convenience and speed of a GUI. Jesse Peterson filled this void with Margarita, a web front end for Reposado that also runs on Mac or Linux.

We run Reposado on a Red Hat Enterprise Linux (RHEL) 6 server, and I recently installed and configured Margarita incase someone else needed an easy way to add an update to a branch. The only unfortunate part about Margarita on Linux is that it doesn’t startup automatically. If you plan to use Reposado and Margarita on a Mac, Jesse has a launchd task to accomplish this.

After the jump, I’ll explain to how to install the Margarita startup script I wrote for our RHEL 6 server.

Posted on my GitHub repo you’ll find the margarita script. First things first, get a working installion of Reposado and Margarita on your server. I won’t cover these topics as the links given above should tell you how to do that. Once that’s done, download a copy of the margarita script to your RHEL server (this should work automatically for CentOS too). Move the script to /etc/init.d/margarita and change its permissions to 755:

chmod 755 /etc/init.d/margarita

Add margarita to chkconfig, and ensure it’s set to “on” on levels 3, 5, and 6:

chkconfig --add margarita

chkconfig --list margarita

The output of the last command should have been:

margarita       0:off   1:off   2:off   3:on    4:off   5:on    6:on

If it’s not, run the following command:

chkconfig --level 356 margarita on

Now it’s time to start the service! (NOTE: If you know how, it’s a good idea to not run margarita as root. However, that is outside the scope of this post)

sudo service margarita start

Optional: It’s a good idea to configure log rolling for this new service. To do so, create the following file /etc/logrotate.d/margarita and copy and paste the following into it:

/var/log/margarita.log {
rotate 10
/etc/init.d/margarita restart

The second last line restarts the margarita service after the log has been rotated. If you don’t restart it, Margarita will continue writing to the old log even though it has been renamed.

You’re done! You can now control the status of Margarita by using the service command. Available options are: start, stop, restart, and status. If anyone has any questions please feel free to leave a comment!


2 thoughts on “Linux/Mac – Have Margarita Startup Automatically On Boot

  1. I know this is maybe late but thanks for the script, have made a minor adjustment to also include “Status”. Thanks again

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s