#!/bin/bash version="0.9" main_file="monitor.go" target_dir="./outputdir/" target_file="" include_resource="eagle.properties log.properties start.sh stop.sh" rm -rf $target_dir* if [ ! -x "$target_dir" ]; then mkdir -p "$target_dir" fi if [ -z $target_file ];then target_file=${main_file%".go"*} fi build_command="go build -o $target_dir$target_file $main_file" echo $build_command $build_command cp -r $include_resource $target_dir cd $target_dir tar zcvf $target_file-$version.tar.gz * cd -
#!/bin/bash current_path=`pwd` case "`uname`" in Linux) bin_abs_path=$(readlink -f $(dirname $0)) ;; *) bin_abs_path=`cd $(dirname $0); pwd` ;; esac if [ -f $bin_abs_path/pid ] ; then echo "found pid:`cat $bin_abs_path/pid` , Please run stop.sh first ,then startup.sh" 2>&2 exit 1 fi nohup $bin_abs_path/monitor 1>>$bin_abs_path/nohup.out 2>&1 & echo $! > $bin_abs_path/pid echo "start successfully!"
#!/bin/bash current_path=`pwd` case "`uname`" in Linux) bin_abs_path=$(readlink -f $(dirname $0)) ;; *) bin_abs_path=`cd $(dirname $0); pwd` ;; esac echo $bin_abs_path if [ -f $bin_abs_path/pid ] ; then kill `cat $bin_abs_path/pid` echo "stop successfully!" else echo "not found $bin_abs_path/pid!" fi rm $bin_abs_path/pid