ssh: connect to host 192.168.100.1 port 22: Connection timed out
ssh 192.168.100.1 hostname 2>/dev/null
Monthly Archives: October 2022
bash do not create file if empty result
tee empty file
use ifne
grep -ri website /etc/apache2 | ifne tee /tmp/outout.log
rm also can help:
grep -ri website /etc/apache2 > /tmp/outout.log ; [[ $? -ne 0 ]] && 'rm' -f /tmp/outout.log
varnish systemd 80 port
mkdir /etc/systemd/system/varnish.service.d
vim /etc/systemd/system/varnish.service.d/varnishd.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T 127.0.0.1:8081 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
systemctl daemon-reload && systemctl start varnish
install keepalive 2 ubuntu
add-apt-repository ppa:hnakamur/keepalived
upstream repository: https://github.com/acassen/keepalived
deb source repository: https://github.com/hnakamur/keepalived-deb
More info: https://launchpad.net/~hnakamur/+archive/ubuntu/keepalived
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmprfmnb5nq/secring.gpg' created
gpg: keyring `/tmp/tmprfmnb5nq/pubring.gpg' created
gpg: requesting key 1017341E from hkp server keyserver.ubuntu.com
gpg: /tmp/tmprfmnb5nq/trustdb.gpg: trustdb created
gpg: key 1017341E: public key "Launchpad PPA for Hiroaki Nakamura" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
mv -v /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt /tmp/
'/usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt' -> '/tmp/DST_Root_CA_X3.crt'
update-ca-certificates
Updating certificates in /etc/ssl/certs...
W: /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt not found, but listed in /etc/ca-certificates.conf.
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
apt update
sed leave only 1000 last lines
instead sed use tail:
tail -n 1000 file.log | sponge file.log
ubuntu iptables remove all rules
iptables allow all:
iptables -P INPUT ACCEPT && iptables -P FORWARD ACCEPT && iptables -P OUTPUT ACCEPT && iptables -t nat -F && iptables -t mangle -F && iptables -F && iptables -X && iptables-save > /etc/iptables/rules.v4
mysql extract table from dump
sed -n -e '/DROP TABLE.*`my_table`/,/UNLOCK TABLES/p' mydump.sql > table.sql
make sure table is correct:
egrep -h "DROP TABLE|CREATE TABLE" table.sql
DROP TABLE IF EXISTS `my_table`;
CREATE TABLE `my_table` (