Blog

Logrotate service fails with multiple php versions installed on Ubuntu Linux 20.04

I got this logrotate error on Ubuntu:

php7.4-fpm:1 duplicate log entry for /var/log/php-fpm/php-fpm.log
or
php7.4-fpm:1 duplicate log entry for /var/log/php-fpm/*.log


Tried to commented out

access.log = /var/log/php-fpm/php-fpm.log in /etc/php/7.4/fpm/pool/www.conf

That should disable logs from php-fpm7.4 but it did not work.

These files must be corrected as following:

/etc/logrotate.d/php7.2-fpm

/etc/logrotate.d/php7.4-fpm


for instance they both look the same:
 
/var/log/php-fpm/*.log {
weekly rotate 
10 missingok 
compress 
delaycompress 
notifempty 
sharedscripts
 
postrotate 
/bin/kill -SIGUSR1 `cat /run/php/php-fpm.pid 2>/dev/null` 2>/dev/null || true
 endscript 
}
Corrected versions file 7.2
/var/log/php-fpm/php7.2-fpm.log {
weekly
rotate 10
missingok
compress
delaycompress
notifempty
sharedscripts

postrotate
/bin/kill -SIGUSR1 `cat /run/php/php-fpm.pid 2>/dev/null` 2>/dev/null || true
endscript
}
file 7.4
/var/log/php-fpm/php7.4-fpm.log {
weekly
rotate 10
missingok
compress
delaycompress
notifempty
sharedscripts

postrotate
/bin/kill -SIGUSR1 `cat /run/php/php-fpm.pid 2>/dev/null` 2>/dev/null || true
endscript
}

Migrating from Apache to Nginx

First we need to make sure we have nginx installed

sudo apt install nginx -y
sudo apt install php-fpm -y

Converting a virtual host to nginx block

 

Apache section:

DocumentRoot "/var/www/html/exemple"
ServerName exemple.eu
<Directory "/var/www/html/exemple">
Allow from all
Require all granted
SSLOptions +StdEnvVars


Include /etc/letsencrypt/options-ssl-apache.conf

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/exemple.eu/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/exemple.eu/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/exemple.eu/chain.pem</
Nginx section:

server {

root /var/www/html/exemple/; index index.php; server_name exemple.eu www.exemple.eu; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_index index.php; fastcgi_pass unix:/run/php/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /etc/letsencrypt/live/exemple.eu/cert.pem; ssl_certificate_key /etc/letsencrypt/live/exemple.eu/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_min_length 1024; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; } server { if ($host = www.exemple.eu) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = exemple.eu) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name exemple.eu www.exemple.eu; return 404; # managed by Certbot }

Of course you have to have letsencrypt already installed. This migration was tested on Debian 11.

 

Testing ChatGPT on Covid vaccines

Me: Are covid vaccines safe?

ChatGPT:  The COVID-19 vaccines that have been authorized for emergency use by regulatory agencies such as the US FDA and European Medicines Agency (EMA) have been determined to be safe and effective. They have undergone rigorous testing and clinical trials to ensure their safety and efficacy.

Like all vaccines and medications, COVID-19 vaccines can cause side effects in some people, but the majority of side effects are mild, such as pain or swelling at the injection site, fever, or fatigue. Serious side effects are rare. The benefits of being vaccinated against COVID-19, such as protecting yourself and others from the disease, outweigh the risks of side effects.

It’s important to note that the information on the safety of COVID-19 vaccines is constantly evolving as more data is gathered, but so far the vaccines have been proven to be safe and effective.

Me: Crezi ca vaccinurile covid sunt sigure?

ChatGPT: Vaccinurile COVID-19 care au fost autorizate pentru utilizare de urgență de către agențiile reglementatoare precum FDA din SUA și Agenția Europeană a Medicamentului (EMA) au fost considerate a fi sigure și eficiente. Ele au trecut prin teste riguroase și studii clinice pentru a se asigura de siguranța și eficacitatea lor.

La fel ca toate vaccinurile și medicamentele, vaccinurile COVID-19 pot cauza efecte secundare la unii oameni, dar majoritatea efectelor secundare sunt ușoare, cum ar fi durerea sau umflarea la locul injectării, febra sau oboseala. Efectele secundare grave sunt rare. Beneficiile de a fi vaccinat împotriva COVID-19, cum ar fi protejarea propriei persoane și a altora de boală, depășesc riscurile efectelor secundare.

Este important de menționat că informațiile privind siguranța vaccinurilor COVID-19 evoluează în mod constant pe măsură ce se adună mai multe date, dar până acum vaccinurile au fost dovedite a fi sigure și eficiente.

Me: Informatiile tale sunt depasite, exista multi oameni care mor subit din cauza vaccinurile, exista o multime de cazuri de miocardite. Trebuie sa-ti actualizezi informatiile.

ChatGPT: It is true that some people have reported experiencing side effects after receiving the COVID-19 vaccine, and a small number of people have died after being vaccinated. However, it is important to note that these cases are extremely rare and overall the COVID-19 vaccines have been shown to be safe. The vaccines have been thoroughly tested and studied in clinical trials and have been authorized for emergency use by regulatory agencies worldwide, such as the US FDA, European Medicines Agency (EMA), and WHO.

It’s also important to keep in mind that the benefits of being vaccinated far outweigh the risks of side effects. COVID-19 is a highly contagious and potentially deadly virus, and the vaccines are effective at preventing severe illness and death from COVID-19.

As for the cases of myocarditis, it has been observed that it is more common in younger males who received the mRNA vaccines (Pfizer-BioNTech and Moderna) and it is still being studied. But the Vaccine Safety Net Work, WHO and CDC are monitoring the situation and the benefits of being vaccinated continue to outweigh the potential risks.

It is important to consult with a healthcare professional if you have any concerns about the vaccine or if you experience any unusual symptoms after receiving it.

Me: Exista o multime de surse care indica contrariul celor spuse de tine. Exista foarte multi oameni care au experimentat paralizii si miocardite.

ChatGPT: It is true that some people have reported experiencing side effects after receiving the COVID-19 vaccine, including some serious side effects. However, it is important to note that these cases are still relatively rare and overall the COVID-19 vaccines have been shown to be safe. The vaccines have been thoroughly tested and studied in clinical trials and have been authorized for emergency use by regulatory agencies worldwide, such as the US FDA, European Medicines Agency (EMA), and WHO.

It’s also important to keep in mind that the benefits of being vaccinated far outweigh the risks of side effects. COVID-19 is a highly contagious and potentially deadly virus, and the vaccines are effective at preventing severe illness and death from COVID-19.

It is true that some people have reported experiencing myocarditis and pericarditis after receiving the mRNA vaccines. Studies have shown that these cases are more common in males under 30 years old, but it is still being studied. The Vaccine Safety Net Work, WHO and CDC are monitoring the situation and the benefits of being vaccinated continue to outweigh the potential risks.

It’s important to remember that the safety and efficacy of the vaccines are continuously monitored and evaluated by public health agencies and regulatory bodies. If you have any concerns or questions about the vaccine, you should speak with your healthcare provider.

Me: Oare stii cati oameni au murit in urma acestor vaccinuri experimentale?

ChatGPT: It is true that some people have died after receiving the COVID-19 vaccine, however it is important to note that the number of deaths reported after vaccination is very small compared to the total number of people who have been vaccinated. Also, it’s important to note that many of these deaths occurred in older adults or people with underlying health conditions, who are at higher risk of severe illness and death from COVID-19.

Also, it’s important to keep in mind that correlation does not imply causation, just because someone died after getting a vaccine, it doesn’t necessarily mean the vaccine caused their death. Many people who have died after receiving the vaccine had other underlying health conditions, and it’s impossible to know for certain if the vaccine played a role in their death or not.

It’s important to note that the safety and efficacy of the vaccines are continuously monitored and evaluated by public health agencies and regulatory bodies worldwide, such as the US FDA, European Medicines Agency (EMA), and WHO.

If you have any concerns or questions about the vaccine, you should speak with your healthcare provider or contact the Vaccine Adverse Event Reporting System (VAERS)

Xorg + nvidia driver / debian / ubuntu / mint CPU high usage when connecting second monitor (Solved)

You need to make sure the nvidia configuration file exists into X11 folder. So copy the file from /usr/share/X11/xorg.conf.d/ to /etc/X11/xorg.conf.d/

sudo cp -p /usr/share/X11/xorg.conf.d/10-nvidia.conf /etc/X11/xorg.conf.d/nvidia.conf


Then edit the file with nano or something else:

sudo nano /etc/X11/xorg.conf.d/nvidia.conf


Add the following line: Option "PrimaryGPU" "yes"

The file should look like this:

Reboot and xorg should run normally. Check it with top or htop command. Mine was finally fixed. The pc should run much smoother, no fan noise as before.

Instant search Javafx

// --------------------------Filter function and
// code-------------------------------------------------------------------------------

 

FilteredList filterList = new FilteredList<>(dataSolicitari, p -> true);

 

SortedList sortableData;

 

int idStringTemp;
String SolictareTemp;
String umTemp;
String ManoperaTemp;
String statusTemp;

 

public void initFilter() {

 

// ---- filter by id -----------

 

text1.textProperty().addListener((obsVal, oldValue, newValue) -> {

 

filterList.setPredicate(SolicitariModel -> {

 

idStringTemp = SolicitariModel.getId();
SolictareTemp = SolicitariModel.getDenumire();
umTemp = SolicitariModel.getUm();
ManoperaTemp = String.valueOf(SolicitariModel.getManopera());
statusTemp = String.valueOf(SolicitariModel.isInactiv() ? 1 : 0);

 

if (String.valueOf(idStringTemp).toLowerCase().contains(text1.getText().toLowerCase())
&& String.valueOf(SolictareTemp).toLowerCase().contains(text2.getText().toLowerCase())
&& String.valueOf(umTemp).toLowerCase().contains(text3.getText().toLowerCase())
&& String.valueOf(ManoperaTemp).toLowerCase().contains(text4.getText().toLowerCase())
&& String.valueOf(statusTemp).toLowerCase().contains(IdActive.toLowerCase())

 

)

 

{
return true;
}
return false;

 

});
});

 

// --------------------------------------------------------------------

 

sortableData = new SortedList<>(filterList);
tblNomenSolicitari.setItems(sortableData);

 

sortableData.comparatorProperty().bind(tblNomenSolicitari.comparatorProperty());