Running standalone Apache Archiva in Gentoo?

I have a server running Gentoo 2.6.12 r6, and I want to start Apache Archiva as a standalone server at startup. Does anyone have a working init.d script to execute this? Thanks!

+4
source share
1 answer

Assuming you created a user account named archiva and Archiva is set to /opt/archiva-1.0 .

By logging in as root , create the script /etc/rc.d/init.d/archiva as follows:

  \ #!  / bin / sh

 start () {
     echo "Starting Archiva ..."
     su -l archiva -c '/opt/archiva-1.0/bin/archiva start> / dev / null 2> / dev / null &'
 }

 stop () {
     echo "Stopping Archiva ..."
     su -l archiva -c '/opt/archiva-1.0/bin/archiva stop &'
 }

 restart () {
     stop
     sleep 60
     su -l archiva -c 'killall java'
     start
 }

 case "$ 1" in
     start)
         start
         ;;
     stop)
         stop
         ;;
     restart)
         restart
         ;;
     *)
         echo "Usage: archiva {start | stop | restart}"
         exit 1

 esac

 exit 0

Now run the following commands as root, where SXX and KXX set the startup and shutdown order. For example, S63 and K37

  $ chmod 775 /etc/rc.d/init.d/archiva
 $ ln -s /etc/rc.d/init.d/archiva /etc/rc3.d/SXXarchiva
 $ ln -s /etc/rc.d/init.d/archiva /etc/rc3.d/KXXarchiva
+2
source

Source: https://habr.com/ru/post/1277194/


All Articles