Monthly Archives: August 2020

centos 7 mysql 5.7

yum install https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm -y

yum repolist enabled | grep “mysql.*-community.*”
mysql-connectors-community/x86_64 MySQL Connectors Community 165
mysql-tools-community/x86_64 MySQL Tools Community 115
mysql57-community/x86_64 MySQL 5.7 Community Server 444

systemctl start mysqld
grep ‘temporary password’ /var/log/mysqld.log
2020-08-08T18:56:50.367913Z 1 [Note] A temporary password is generated for root@localhost: xxxxxxxxxxxxx

converting CentOS 7 to VZ7

centos install virtuozzo
yum install epel-release
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/o/openvz-release-7.0.14-3.vz7.x86_64.rpm
yum localinstall openvz-release-7.0.14-3.vz7.x86_64.rpm python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm

wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/r/readykernel-scan-0.11-1.vl7.noarch.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/z/zstd-1.4.4-1.vl7.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/v/vzlinux-release-7-1.vl7.90.x86_64.rpm

mv /etc/yum.repos.d/CentOS-* /root/

rpm -e --nodeps --justdb json-c
yum erase jansson
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm

yum localinstall jansson-2.10-1.vl7.1.x86_64.rpm
yum localinstall json-c-0.11-13.vl7.1.x86_64.rpm
yum install prlctl prl-disp-service vzkernel *ploop*
yum update

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : Virtuozzo (3.10.0-1127.18.2.el7.x86_64) 7.0.14
1 : Virtuozzo (3.10.0-1127.8.2.vz7.151.14) 7.0.14
2 : Virtuozzo (3.10.0-1127.8.2.el7.x86_64) 7.0.14
3 : Virtuozzo (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7.0.14

grub2-set-default 1
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

#OVZ templates
yum install *ez.noarch

nohup style php


$lock = fopen('/path/to/pid', 'c+');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
die('already running');
}

switch ($pid = pcntl_fork()) {
case -1:
die('unable to fork');
case 0: // this is the child process
break;
default: // otherwise this is the parent process
fseek($lock, 0);
ftruncate($lock, 0);
fwrite($lock, $pid);
fflush($lock);
exit;
}

if (posix_setsid() === -1) {
die('could not setsid');
}

fclose(STDIN);
fclose(STDOUT);
fclose(STDERR);

$stdIn = fopen('/dev/null', 'r'); // set fd/0
$stdOut = fopen('/dev/null', 'w'); // set fd/1
$stdErr = fopen('php://stdout', 'w'); // a hack to duplicate fd/1 to 2

pcntl_signal(SIGTSTP, SIG_IGN);
pcntl_signal(SIGTTOU, SIG_IGN);
pcntl_signal(SIGTTIN, SIG_IGN);
pcntl_signal(SIGHUP, SIG_IGN);

// do some staff

// to kill the proccess
$lock = fopen(‘/path/to/pid’, ‘c+’);
if (flock($lock, LOCK_EX | LOCK_NB)) {
die(‘process not running’);
}
$pid = fgets($lock);

posix_kill($pid, SIGTERM);

[TOTEM ] knet_handle_new failed: File name too long (36)

corosync fails to start

Aug 01 11:32:30 ubu1 corosync[5546]: [TOTEM ] Initializing transport (Kronosnet).
Aug 01 11:32:30 ubu1 corosync[5546]: [TOTEM ] knet_handle_new failed: File name too long (36)
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] transport: Failed to set socket buffer via force option 33: Operation not permitted
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] transport: Unable to set local socketpair receive buffer: File name too long
Aug 01 11:32:30 ubu1 corosync[5546]: [KNET ] handle: Unable to initialize internal hostsockpair: File name too long
Aug 01 11:32:30 ubu1 corosync[5546]: [MAIN ] Can’t initialize TOTEM layer
Aug 01 11:32:30 ubu1 corosync[5546]: [MAIN ] Corosync Cluster Engine exiting with status 15 at main.c:1531.
Aug 01 11:32:30 ubu1 systemd[1]: corosync.service: Main process exited, code=exited, status=15/n/a
Aug 01 11:32:30 ubu1 systemd[1]: corosync.service: Failed with result ‘exit-code’.
Aug 01 11:32:30 ubu1 systemd[1]: Failed to start Corosync Cluster Engine.

sudo sysctl -w net.core.wmem_max=8388608
sudo sysctl -w net.core.rmem_max=8388608

sudo systemctl restart corosync.service