linux下转换windows文件格式为unix sed -i 's/ //' 转化为unix格式
spring boot架包在linux中启动脚本
#!/bin/bash source /etc/profile debug=' -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8010,suspend=n' vm_arg='-Xms800m -Xmx800m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=256m -XX:SurvivorRatio=6 -XX:NewRatio=2 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -verbose:gc -Xloggc:./gc.log -XX:ErrorFile=./jvm_error.log' main_jar='xxxx-service-1.0.0.jar' pid=`ps -ef | grep ${main_jar} |awk '{ if(index($0,"java")>0){print $2}}'` if [[ "${pid}" == "" ]]; then echo 'service is not running,will skip stop command' else curl $url/stop kill -9 ${pid} sleep 1 echo 'kill '${pid} ps -ef |grep ${ctx} fi # 从命令行读取进程名称 NAME='phantomjs' echo "---------------" echo 'killing ->' $NAME # 过滤进程列表,不显示grep对应的进程,awk从第二列获取进程ID ID=`ps -ef | grep "$NAME" | grep -v "grep" | awk '{print $2}'` echo 'found ID list:' $ID for id in $ID do # 杀掉进程 kill -9 $id echo "killed $id" done echo "---------------" spring_arg="--spring.config.location=res/ --spring.profiles.active=test" #spring_arg=" --spring.profiles.active=test" start_cmd="java ${vm_arg} ${debug} -jar ${main_jar} ${spring_arg}" nohup_start="nohup "$start_cmd" >start.log 2>&1 &" echo ${nohup_start} eval $nohup_start sleep 3 tail -n200 start.log
windows文件传到lnux中,启动./service.sh报错如下:
-bash: ./service.sh: /bin/bash^M: bad interpreter: No such file or directory
直接执行下面命令来转化, 然后就可以执行./service.sh运行脚本了。
sed -i "s/ //" a.sh