%PDF- %PDF-
Direktori : /proc/985914/root/data/old/home/stash/atlassian/stash/3.7.1/bin/ |
Current File : //proc/985914/root/data/old/home/stash/atlassian/stash/3.7.1/bin/install_linux_service.sh |
#!/usr/bin/env bash . `dirname $0`/user.sh #readin the username stash_account= if [ -z "$STASH_USER" ]; then stash_account="stash" else stash_account=$STASH_USER fi if [[ $1 == "-u" ]]; then echo uninstalling STASH as a service if [[ -x $(which update-rc.d) ]]; then update-rc.d -f $stash_account remove rm -f /etc/init.d/$stash_account else rm -f /etc/init.d/$stash_account /etc/rc1.d/{S,K}95$stash_account for (( i=1; i<=5; i++ )); do rm -f /etc/rc$i.d/{S,K}95$stash_account done fi else if [[ -d /etc/init.d ]]; then echo installing STASH as a service STASH_BIN=`dirname $0` cat >/etc/init.d/$stash_account <<EOF #!/usr/bin/env bash ### BEGIN INIT INFO # Provides: stash # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Stash daemon at boot time # Description: Start Stash daemon at boot time ### END INIT INFO # THIS SCRIPT HAS BEEN CONFIGURED TO RUN AS PART OF RUN LEVELS 2 TO 5 # IF YOU WISH TO CHANGE THIS CONFIGURATION YOU WILL HAVE TO DO IT MANUALLY PIDFILE=$STASH_BIN/../work/catalina.pid start() { ./start-stash.sh } stop() { ./stop-stash.sh } status() { if [ -f \$PIDFILE ] then PID=\$(<\$PIDFILE) if kill -0 \$PID &>1 > /dev/null then echo "Stash is running" exit 0 fi fi echo "Stash is not running" } # STASH Linux service controller script cd $STASH_BIN case "\$1" in start) start ;; stop) stop ;; status) status ;; restart) stop start ;; *) echo "Usage: \$0 {start|stop|status}" exit 1 ;; esac EOF chmod +x /etc/init.d/$stash_account if [[ -x $(which update-rc.d) ]]; then update-rc.d -f $stash_account defaults else ln -s /etc/init.d/$stash_account /etc/rc2.d/K95$stash_account ln -s /etc/init.d/$stash_account /etc/rc3.d/S95$stash_account ln -s /etc/init.d/$stash_account /etc/rc4.d/K95$stash_account ln -s /etc/init.d/$stash_account /etc/rc5.d/S95$stash_account fi fi fi