AEM startup on System Boot in Linux

17 / Oct / 2013 by Ankur Mittal 0 comments

If you want to make your CQ/AEM instance start on system boot in Windows Operating System, i am sure you will find a lot of documentation on that. Even Day (now Adobe) has a page on installing CQ as a Window service.
But you will hardly find any page on making your CQ/AEM instance start on system boot in Linux Operating System.

I was trying this in Ubuntu 13.0 64 bit OS, but with some R & D, and some help, i was able to achieve this the hard way.

So here goes the steps to make your CQ start on system boot in Linux:

  1. First you need to create a shell file with some shell script that describes start, stop and status case for CQ. For now lets say you created cq5init.sh file.
    Also lets assume you have installed your CQ instance in /opt directory. So now your crx-quickstart is located in /opt/cq5/crx-quickstart.
  2. Then you need to move shell file to init.d directory in linux. Use following to move your file:
    # Make sure your terminal is pointing to the directory 
    # where you have saved 
    cq5init file sudo mv cq5init /etc/init.d/ 
  3. Then you need to make your shell file executable with raised priviliges using following command:
    sudo chmod +x /etc/init.d/cq5init 
  4. Before i explain next step, following information might be helpful to understand the next command –>
    Linux services can be started, stopped and reloaded with the use of scripts stocked in /etc/init.d/.
    However, during start up or when changing runlevel, those scripts are searched in /etc/rcX.d/ where X is the runlevel number.
    When installing a new service under debian, the default is to enable it. So for instance, if you just installed apache2 package, after you installed it, apache service will be started and so will it be upon the next reboots.You could either disable this service on boot up by removing any symbolic links in/etc/rcX.d/SYYapache2 or by using update-rc.d.The advantage of using update-rc.d is that it will take care of removing/adding any required links to /etc/init.d automatically.So on same lines, next command is to register your service with update-rc.d:

    sudo update-rc.d cq5init defaults 
  5. Now just reboot your system, and if you have done your steps right, your CQ instance will automatically get up.

If i missed any details, that might be helpful to implement this, please post a comment. And if you need help writing the exact shell file for CQ, contact me through comments.

Cheerz.. Enjoy Programming :)

Tag -

AEM CQ5
FOUND THIS USEFUL? SHARE IT

Leave a comment -