Page 1 of 1

Automatically restart services if down?

Posted: Fri Apr 03, 2015 10:41 pm
by Galaxian
Is there a way to automatically restart services after they go down? Twice my MySQL has gone down and has not restarted. cPanel did this, but Vesta doesn't seem to. It's important because sites remain down. :(

Re: Automatically restart services if down?

Posted: Sat Apr 04, 2015 8:05 am
by ScIT
Normally Apache2 ando MySQL shouldnt not go down without any reason. Maybe check first why the services go offline.

You can also maybe write a shell script that you can run every minute to check if apache online, if not just start them. But as already said, first check the reason why they goes down - maybe you will find somethin in apache2 and mysql log - you can also post them here if you want.

Re: Automatically restart services if down?

Posted: Sat Apr 04, 2015 11:59 am
by Galaxian
There's a chunk in there regarding InnoDB initialising and writing to log file, but this part at the end seems strange:

Code: Select all

150203 17:41:56 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.41'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi
150205 10:49:22 [Warning] IP address '61.136.251.196' could not be resolved: Name or service not known
150207 17:38:28 [Warning] IP address '61.240.144.66' could not be resolved: Temporary failure in name resolution
150208  6:11:53 [Warning] IP address '125.65.42.21' could not be resolved: Name or service not known
150210 11:53:55 [Warning] IP address '61.240.144.67' could not be resolved: Temporary failure in name resolution
150211 21:50:33 [Warning] IP address '61.240.144.66' could not be resolved: Temporary failure in name resolution
150211 23:07:17 [Warning] IP address '219.235.1.242' could not be resolved: Name or service not known
150211 23:07:19 [Warning] IP address '219.235.1.242' could not be resolved: Name or service not known
150212  8:18:53 [Warning] IP address '59.45.67.211' has been resolved to the host name '211.67.45.59.broad.bx.ln.dynamic.163data.com.cn', which resembles IPv4-address itself.
150212 19:58:27 [Warning] IP address '114.111.167.83' could not be resolved: Temporary failure in name resolution
150212 19:58:27 [Warning] IP address '114.111.167.83' could not be resolved: Temporary failure in name resolution
150212 19:58:28 [Warning] IP address '114.111.167.83' could not be resolved: Temporary failure in name resolution
150212 19:58:29 [Warning] IP address '114.111.167.83' could not be resolved: Temporary failure in name resolution
150212 19:58:33 [Warning] IP address '114.111.167.83' could not be resolved: Temporary failure in name resolution
150213  2:53:59 [Warning] IP address '61.240.144.66' could not be resolved: Temporary failure in name resolution
150214  0:24:23 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  0:24:28 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  0:24:37 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  0:24:57 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  0:25:20 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  0:25:54 [Warning] IP address '116.255.162.38' could not be resolved: Temporary failure in name resolution
150214  9:19:14 [Warning] IP address '61.240.144.64' could not be resolved: Temporary failure in name resolution
150216  6:51:04 [Warning] IP address '182.254.218.196' could not be resolved: Name or service not known
150217 16:22:21 [Warning] IP address '222.186.13.25' could not be resolved: Name or service not known
150217 23:10:14 [Warning] IP address '61.240.144.66' could not be resolved: Temporary failure in name resolution
150220 12:08:41 [Warning] IP address '118.122.252.71' could not be resolved: Name or service not known
150220 18:14:05 [Warning] IP address '61.240.144.66' could not be resolved: Temporary failure in name resolution
Seems kind of spammy. Do you know what this is?

Re: Automatically restart services if down?

Posted: Sat Apr 04, 2015 12:08 pm
by ScIT
it seems you have exposed your mysql server directly to the internet. Please check your mysql and iptables config.

MySQL warning “IP address could not be resolved” -> http://serverfault.com/questions/393862 ... e-resolved

Re: Automatically restart services if down?

Posted: Sun Apr 05, 2015 10:47 pm
by bobogroup
ScIT wrote:it seems you have exposed your mysql server directly to the internet. Please check your mysql and iptables config.

MySQL warning “IP address could not be resolved” -> http://serverfault.com/questions/393862 ... e-resolved

1. check your my.cnf for correct setting
2. you can install and setup monit for autorestart services