2008-09-26 84 views

回答

2

假設您已創建一個名爲archiva的用戶帳戶,並且Archiva安裝在/opt/archiva-1.0處。

雖然記錄爲root,創建一個腳本/etc/rc.d/init.d/archiva如下:

 
\#! /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 

現在,執行以下命令根在那裏SXX和KXX指定啓動和關機順序。例如S63和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 
+0

「killall java」cmd殺死每個java進程哪個archiva用戶能夠殺死 – 2012-04-10 07:45:58