我已经写了一个脚本来重新启动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
我可以通过更新 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
我希望这可以帮助别人。