0

I have written a script to restart tomcat service

# 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

I want to run this script daily just before midnight using crontab, but the cron job is throwing an error

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

Can anyone help me with this issue please?

AL̲̳I
  • 2,441
  • 4
  • 29
  • 50
  • Fix the PATH in the script. [How to get CRON to call in the correct PATHs](https://stackoverflow.com/q/2388087/608639). – jww Nov 13 '19 at 20:56

1 Answers1

0

I was able to achieve this by updating the crontab entry

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
halfer
  • 19,824
  • 17
  • 99
  • 186
AL̲̳I
  • 2,441
  • 4
  • 29
  • 50