IS there a way to start re-start services automatically if they go down?


Sometimes the litespeed server goes down or Maria database, then clients or myself has to manually start the service from the cyberpanel admin. is there a way if one of those services goes down automatically turn them on or sends an email to serveradmin to restart.

I have ubuntu

Much appreciated


  • Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    You can now earn with the Cyberhosting affiliate scheme. Join today
  • Buff, I am an nerd on this... must simpler way to start Lls on failure on ubuntu, got lost there!
    Thanks hennaboy
  • edited December 2019
    I wrote this a while ago and it works very well. Add the content below to a bash script and run both commands under "Check each 5 minutes" (change /your/ to the location and name of your file).


    # Check each 5 minutes
    # echo "*/5 * * * * bash /your/" >> /var/spool/cron/root
    # chmod +x /your/

    # Array with: OLS PHP MariaDB PureFTP Postfix Dovecot Crontab
    declare -a arr=("lsws" "lscpd" "mariadb" "pure-ftpd" "postfix.service" "dovecot" "crond.service")

    # Loop through the above array
    for i in "${arr[@]}"
    status=$(systemctl status $i | grep Active: | cut -f2 -d"(" | cut -f1 -d")" | tr -d $'\n')
    if [ "$status" != 'running' ]; then
    systemctl restart $i
    if [ "$i" = 'postfix.service' ]; then # Clear Postfix Mail Queue
    postsuper -d ALL
    postsuper -d ALL deferred

    # You are all set!
  • thanks , already implemented!
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!