33 lines
701 B
Bash
Executable File

#!/bin/bash
GITBUCKETPATH="/home/mollusk/Downloads"
WARFILE="gitbucket.war"
case "$1" in
start) nohup java -jar ${GITBUCKETPATH}/${WARFILE} &> /dev/null &
sleep 1
PID=$(pidof java)
if [ ${PID} ];then
notify-send "Gitbucket started on PID: ${PID}"
echo "Gitbucket started on PID: ${PID}"
else
notify-send "Gitbucket Failed to start!"
echo "Gitbucket process failed to start!"
fi
;;
stop) killall java
if [ ! ${PID} ];then
notify-send "Gitbucket was terminated"
echo "Gitbucket was terminated"
else
notify-send "There was a problem terminating Gitbucket"
echo "There was a problem terminating Gitbucket"
fi
;;
status) ps -fC java
;;
esac