How to start Alfresco at boot time as a user other than root.

It’s possible to start Alfresco at boot time by adding a simple line to /etc/rc.d/rc.local on Red Hat-like distros or some similar equivalence on Debian-based systems. The problem with that, however, is that you won’t start and stop Alfresco the correct way if you reboot, which can lead to old PID files being left behind blocking Tomcat. Instead, we use a script in the init.d folder which catches reboots and shutdowns.

If starting and stopping Alfresco correctly at reboots was all you wanted to do, you could have just used a symbolic link in init.d pointing to the alfresco script in the installation folder (alfresco.sh e.g.), but since we want to run the system as an arbitrary, non-privileged user, e.g. user ‘alfresco’, we need a wrapper script that uses su.

Here is an example of the above for Ubuntu 10.10 with Alfresco 4 (use sudo with the commands below if you’re not running as root):

  • touch /etc/init.d/alfresco
    • (Owner should be root)
  • chmod 755 /etc/init.d/alfresco
    • (Make it executable)
  • update-rc.d alfresco defaults 80
    • This connects the script with the default rcN.d links, and priority 80 which makes it very likely it will be run last of the scripts per runlevel.
  • emacs /etc/init.d/alfresco
  • Enter the following in the file:

 

 

  • Replace ”/opt/alfresco-4.0.x” above with the name of your installation folder.
  • Note that you may need to change a few of the default ports in Alfresco to unprivileged ports, since you’re not running as root, e.g. the ports for CIFS if you’re using that.
  • (Note that the su flag ‘-l’ above isn’t bound by any order among the options, as opposed to the synonym ‘-‘ flag which must be the last su option.)

En reaktion på ”How to start Alfresco at boot time as a user other than root.

Kommentera

E-postadressen publiceras inte. Obligatoriska fält är märkta *