Cron jobs help

Discussion in 'Installation/Configuration' started by George Girgolas, Feb 4, 2021.

  1. George Girgolas

    George Girgolas New Member

    ISPconfig 3.2.2, Centos 7.8.2003
    I've created an sh file in order to execute it, as a cron job.
    The file is called and has only this command in it:
    service httpd status &> /dev/null || service httpd start
    I then went to Sites->Cronjobs->Add new cronjob,
    inserted on minutes */30 and all other just stars (every 30 minutes) and command to run


    The reason for creating this is that everyday at 4:06 am my apache stops, so I wanted to create o cron job to start it again.
    Well, the cron job is not running...
    I've raised the log level to debug and run the command
    the output is
    04.02.2021-10:50 - DEBUG - Calling function 'check_phpini_changes' from plugin 'webserver_plugin' raised by action 'server_plugins_loaded'.
    04.02.2021-10:50 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Any ideas?
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Why create such a cronjob through the panel? I would add it to the crontab of root instead, and put the .sh file outside of the web root.

    When running you see the pending tasks, not the cronjobs.
  3. George Girgolas

    George Girgolas New Member

    You mean like entering the crontab from cli, crontab -e and add the cron job there?
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    so even if it works, you're leaving apache stopped for 24 minutes every morning?
    why not create a cron job at 04.06 or 04.07 that starts the apache2 service again?

    and i assume this has been happening for a while, so i'm wondering why you're only asking for help in getting it started again, and not for finding out why it's stopping every day, and how to prevent that.
    Th0m likes this.
  5. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Yes, that would work. Cron jobs entered in ispconfig run as the use of the website to which they are attached, so that would never work to do something that requires root privileges like restarting services.

    Another solution I'd suggest is setting up monit to monitor and restart services.
  6. George Girgolas

    George Girgolas New Member

    Thank for all the suggestions. Cron job created and monit was installed. Today i found my apache up and running!

    Do you have any suggestions on how to debug the stopping of apache everyday at 4:06????
  7. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Take a look at your error.log in /var/log/apache2

Share This Page