Skip to main content

Write a Cronjob on CloudLinux server to run a sh file to restart a service periodicly

Comments

4 comments

  • cPanelMichael
    Hello :) Cron jobs are logged to: /var/log/cron Out of curiosity, which service is it and why are you having to restart it? Thank you.
    0
  • dalem
    try putting in /bin/sh /pathtoshfile/ if that does not call it then add PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin to the top of your crontab
    0
  • armin654
    Dear cPanelMichael! Thank you for your care about my issue. It is just a try on my LAB machine and not something seriously. Thank you for the log location [quote="dalem, post: 1598201">try putting in /bin/sh /pathtoshfile/ if that does not call it then add PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin to the top of your crontab
    Thank you dalem! The problem was that when we call the service, we should give the complete path to it and not just writing the service name. Your help guided me to the answer. Thank you so much
    0
  • cPanelMichael
    I am happy to see the issue is now resolved. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.