如果它没有在我的Rails应用程序中运行,我想启动gem elasticsearch。我不想使用任何其他宝石来做到这一点。 所以我创建了文件start.sh:
if pgrep -u sth java; then
/home/sth/sth/attractions/elasticsearch-1.6.0/bin/elasticsearch
fi
我把它放在crontab中:
* * * * * /home/sth/sth/attractions/start.sh
脚本无效,我不知道为什么。
答案 0 :(得分:0)
Cron不是在Linux下执行此操作的方法,init系统可以在此帮助您:
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service.html