从crontab重新启动ea-tomcat85

时间:2019-11-13 15:46:14

标签: linux tomcat cron

我写了一个脚本来重新启动tomcat服务

# timestamp
ts=`date +%m-%d-%Y_%H:%M:%S`
echo "$ts: Restarting ea-tomcat85..." &>> /home/account_name/restartservice.log
ubic restart ea-tomcat85 &>> /home/account_name/restartservice.log

我想每天午夜之前使用crontab运行此脚本,但是cron作业抛出错误

/home/acount_name/restartservice.sh: line 4: ubic: command not found

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我能够通过更新contab条目来实现这一目标

53 23 * * * PATH=$(dirname $(readlink /usr/local/cpanel/3rdparty/bin/perl)):$PATH ubic restart ea-tomcat85 &>> /home/account_name/ea-tomcat85/myscript/restart-tomcat-service.log

我希望这对某人有帮助。