加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
queue.sh 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
铅笔刀 提交于 2020-12-12 05:46 . 'init'
#!/bin/bash
basepath=$(cd `dirname $0`; pwd)
chmod a+x "$basepath/yii"
command="$basepath/yii queue/listen 1"
command2="$basepath/yii queue3/listen 1"
result=$(ps -ef | grep "`echo $command`" | grep -v "grep")
result2=$(ps -ef | grep "`echo $command2`" | grep -v "grep")
if [ ! -n "$result" ]
then
echo "Starting the process."
str=$(nohup $command >/dev/null 2>&1 &)
echo -e "\033[32mOk.\033[0m"
else
echo "The process has been started."
fi
if [ ! -n "$result2" ]
then
echo "Starting the process3."
str=$(nohup $command2 >/dev/null 2>&1 &)
echo -e "\033[32mOk.\033[0m"
else
echo "The process3 has been started."
fi
result=$(crontab -l|grep -i "* * * * * $basepath/queue.sh"|grep -v grep)
if [ ! -n "$result" ]
then
echo -e "\033[32mCreating queue crontab.\033[0m"
echo "Export crontab data"
crontab -l > createcrontemp
echo "Add new crontab line"
echo "* * * * * $basepath/queue.sh" >> createcrontemp
echo "Import crontab data"
crontab createcrontemp
echo "Delete temp file"
rm -f createcrontemp
echo -e "\033[32mCreating queue crontab success.\033[0m"
else
echo "The queue crontab has been add ."
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化