Task
To refresh Shotwell thumbnails cache.
Description
Shotwell create thumbnail for every picture it display so when you scroll through gallery it will rebuild it. Problem is when storage is slow (SMB over WiFi) it takes some time.
Idea
Force Shotwell to scroll all gallery
Solution
Find id of Shotwell window:
jaqb@linux:~$ xdotool search --onlyvisible --name shotwell 2098671 2099432
As you can see sometimes there are two of them (I don't know why)
Switch to that window an send Page_Down / Next key check.
jaqb@linux:~$ xdotool windowactivate 2099432 --sync key Next
Repeat many many (1000) times but give some time (22s) to refresh all visible pictures. I've prepared bash script:
jaqb@linux:~$ cat ./shotwell-cache-refresh.bash #!/bin/bash xdotool windowactivate --sync $1 for x in `seq 1000`; do sleep 22 xdotool key Next done EOF
After confirmation which identifier is good (2099432) you can run:
jaqb@ubuntu-16:~$ ./shotwell-cache-refresh.bash 209943
and do something more interesting than just typing Page_Down key for more than 6h.
Once, after server crash, I've noticed I've BackupPC shows no backups for some clients. Fortunately /BackupPC/pc/*/ still contains those backups.
To fix a corrupted backups file you should:
- Stop BackupPC
/etc/init.d/backuppc stop
- Run BackupPC_fixupBackupSummary script as backuppc user
sudo -u backuppc /usr/share/backuppc/bin/BackupPC_fixupBackupSummary
- Start BackupPC
/etc/init.d/backuppc start
Now I can see all backups on Host Summary page.
How to detect if there someone is home or if the house is empty.
Prerequisite
- OpenWRT router
- MQTT server
- Something to interpret and display data (Node-RED, Home Assistant, Domoticz, OpenHAB, etc.)
On your OpenWRT router:
Install mosquitto-client. If you don't use encrypted communication use -nossl version.
opkg install mosquitto-client-ssl
Download presence_sensor script:
wget -O /usr/bin/presence_report https://github.com/dersimn/owrtwifi2mqtt/raw/master/presence_report
make it executable:
chmod u+x /usr/bin/presence_report
Now you can check if it works. Run command:
root@OpenWrt:~# /usr/bin/presence_report event 192.168.1.8 presence_report, mode: event, MQTT server: 192.168.1.8
Change 192.168.1.8 to address of your MQTT server. Turn WiFi on one of your devices (my was e6:6a:ca:c8:38:e6).
root@OpenWrt:~# /usr/bin/presence_report event 192.168.1.8 presence_report, mode: event, MQTT server: 192.168.1.8 Mac: e6:6a:ca:c8:38:e6 did del Mac: e6:6a:ca:c8:38:e6 did new
as you can see there my device "left" (del) and connect (new) to Wi-Fi.
Press Ctrl-C to stop test.
To start this every time router boots I've added this line:
(/usr/bin/presence_report event 192.168.1.8 >/dev/null 2>&1 )&
to /etc/rc.local file. Of course before "exit 0".
Using data
You can subscribe to "owrtwifi/status/#" topics to receive messages in topic like this:
owrtwifi/status/mac-e6-6a-ca-c8-38-e6/event
and payload del or new.
They are also messages in topic
owrtwifi/status/mac-e6-6a-ca-c8-38-e6/dhcp-name
and name of your device in payload.
I'm using Node-RED and check every device like this:
context.devicescount=0; if (!context.hasOwnProperty("devices")) { context.devices={}; } if (msg.topic === "owrtwifi/status/mac-e6-6a-ca-c8-38-e6/event") { if (msg.payload === "new") { context.devices.PhoneNo1 = 1; } if (msg.payload === "del") { context.devices.PhoneNo1 = 0; } } // repeat above to all of your mobile devices if (msg.topic === "owrtwifi/status/mac-00-11-22-33-44-55/event") { if (msg.payload === "new") { context.devices.PhoneNo2 = 1; } if (msg.payload === "del") { context.devices.PhoneNo2 = 0; } } let values = Object.values(context.devices); values.forEach(function (value,index) { if (value == 1) { context.devicescount+=1; } return null; }); if (context.devicescount>0) { node.send({payload:{"devices":context.devicescount},topic:"mydevices"}); } else { node.send({payload:{"devices":context.devicescount,"house is empty":1},topic:"mydevices"}); }
Maybe it's not the best way, but it works for me.
The most important value is devicescount - the house is empty if equal to zero.
Of course this method cannot distinguish if you are in home or you just forgot your phone. It's obvious, but I want to be sure you know this too ;-)
When you will try to use VirtualBox on Windows 11 you can notice that VM performance is very low.
One of the reason can be Windows Hypervisor-enforced Code Integrity (HVCI).
The easiest way to check if it active is via Settings > Update & Security > Windows Security > Device security > Core isolation details > Memory integrity.
To turn it off run cmd as privileged user:
bcdedit /set hypervisorlaunchtype off
and restart the system.
Be aware, that HVCI is turned on to improve system security - so turn if off only when you really need it.
Download current binary from site memtest.org. Now current version is 5.31b.
Extract file (in my case memtest86+-5.31b.bin).
Rename it and place somewhere in TFTP server:
mv /tmp/memtest86+-5.31b.bin /data/tftpboot/networkboot/memtest86+-5.31b
as in previous posts my TFTP root is /data/tftpboot and I place all files in networkboot directory.
Add menu entry in pxelinux.cfg/default or as in my examples in pxelinux.cfg/4c4c4544-0042-4410-8053-b2c04f43334a (these magic numbers are my test PC UUID):
LABEL Memtest86-5.31 MENU LABEL Memtest86+ 5.31b KERNEL /networkboot/memtest86+-5.31b
On fresh install ESXi 7.0 U2 you just need two commands:
esxcli system syslog config set --loghost='udp://192.168.1.28:514' esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true
First line configures address of remote syslog server - of course you have to change 192.168.1.28 to yours server IP.
Second one opens required ports on firewall.
My router configuration was:
root@gargoyle:~# uci show dhcp.lan.dhcp_option dhcp.lan.dhcp_option='252,http://wpad/wpad.dat' '6,192.168.1.28,192.168.1.4'
I would like to change WPAD address (option 252) to wpad.lan so I've to remove (del_list) old entry and add (add_list) new one:
root@gargoyle:~# uci del_list dhcp.lan.dhcp_option='252,http://wpad/wpad.dat' root@gargoyle:~# uci add_list dhcp.lan.dhcp_option='252,http://wpad.lan/wpad.dat'
check, if everything is correct:
root@gargoyle:~# uci show dhcp.lan.dhcp_option dhcp.lan.dhcp_option='6,192.168.1.28,192.168.1.4' '252,http://wpad.lan/wpad.dat'
now, You can commit changes (write to /etc/config/dhcp file) and restart dnsmasq daemon:
root@gargoyle:~# uci commit dhcp root@gargoyle:~# /etc/init.d/dnsmasq restart
On client you can check again using nmap command:
[root@Optiplex745 ~]# nmap --script broadcast-dhcp-discover -e enp3s0 Starting Nmap 7.70 ( https://nmap.org ) at 2021-03-17 22:42 CET Pre-scan script results: | broadcast-dhcp-discover: | Response 1 of 1: | IP Offered: 192.168.1.249 | DHCP Message Type: DHCPOFFER | Server Identifier: 192.168.1.4 | IP Address Lease Time: 2m00s | Bootfile Name: undionly.kpxe\x00 | Renewal Time Value: 1m00s | Rebinding Time Value: 1m45s | Subnet Mask: 255.255.255.0 | Broadcast Address: 192.168.1.255 | Router: 192.168.1.4 | Domain Name: lan | WPAD: http://wpad.lan/wpad.dat |_ Domain Name Server: 192.168.1.28, 192.168.1.4 WARNING: No targets were specified, so 0 hosts scanned. Nmap done: 0 IP addresses (0 hosts up) scanned in 3.85 seconds
My last resolution about power button works only when monitor is connected.
If you have headless server you can use systemd-logind service. By default (in CentOS 8) it do nothing. I've only found:
systemd-logind[1373]: Power key pressed
in /var/log/messages.
To change this behaviour you can modify
/etc/systemd/logind.conf
I've uncommented line
#HandlePowerKey=poweroff
After thins restart service:
systemctl restart systemd-logind
Now power key works on headless Linux server.
Booting to PXE (or iPXE) using dnsmasq is rather well documented also by Me ;-).
If You would like to use MikroTik it's not so easy (at least v6.43.2). I couldn't manage to boot iPXE using chainloading because of the infinite loop with the DHCP server.
Booting from PXE is also not so obvious. You cannot set option 66 (next-server/Server-Name) nor 67 (boot-file/Bootfile-Name) in "ip dhcp-server option". Instead set "Next Server" and "Boot File Name" in "ip dhcp-server network", so it should look like this:
[admin@MikroTik] > /ip dhcp-server network print detail Flags: D - dynamic 0 ;;; defconf address=192.168.1.0/24 gateway=192.168.1.15 netmask=24 dns-server=192.168.1.28,192.168.1.15 wins-server="" ntp-server="" caps-manager="" domain="lan" next-server=192.168.1.28 boot-file-name="pxelinux.0" dhcp-option="" dhcp-option-set=""
Add comment