就两行代码,单独执行都没问题,在windows平台下用notepad写了一个test.sh脚本,放到linux就报错
ps -ef|grep start_server.py|grep -v grep|cut -c 9-15|xargs kill -9
nohup /root/anaconda3/bin/python /opt/centos_readhead_detection/release/start_server.py > start_server_log.txt &
[root@localhost release]# bash test.sh
kill: 无效的信号名或数字:9
后来发现linux的换行与windows的不一样
原文件格式为windows格式,其换行符为:cr lf
转换为unix文件格式后,其换行符为:lf
这里保存时要改一下
这样就OK了