OCR all PDFs in a folder by cron

I will not write a long explanation, just this short one. The cronjob looks like this: * * * * * sh -c 'flock -n /tmp/my.lockfile /home/user/scripts/ocr_pdf_scan.sh' This will start sh (a shell, just like bash) and run the command after -c. The command flock will create a lock-file, to prevent that this cron job is started while there is still the previous cron jobs running. The cron job runs every minute, so in crontab it has * * * * * (five stars in front of the command). ...

3. Juli 2023 · 2 Minuten · utzer

rename

… is an easy to use and powerful tool, it can be used to replace part of file name (string1) with some other string. Something one can also do with some “sed” hack, but this tool is much easier to use, especially for beginners. You can get all information needed from “rename –help” (here from Linux Mint): rename --help Usage: rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr [ files ] Options: -v, -verbose Verbose: print names of files successfully renamed. -n, -nono No action: print names of files to be renamed, but don't rename. -f, -force Over write: allow existing files to be over-written. -h, -help Help: print SYNOPSIS and OPTIONS. -m, -man Manual: print manual page. -V, -version Version: show version number. -e Expression: code to act on files name. May be repeated to build up code (like "perl -e"). If no -e, the first argument is used as code. -E Statement: code to act on files name, as -e but terminated by ';'. I did use this tool rename some files that contained the string “www”, which I had to replace with “web”, lets say there were files named like this: ...

29. April 2019 · 2 Minuten · utzer

Resize qemu VM disk

VM runterfahren Image der VM vergrössern: sudo qemu-img resize /var/lib/libvirt/images/vm_disk.img +15GB Je nach Setup ist sudo nicht nötig, durch den Befehl wird die Diskimagedatei um 15 GB vergrößert. VM starten Weiter geht es in der VM auf der Konsole. Partitioen mit parted anzeigen lassen: parted -l Ausgabe so oder ähnlich: Model: Virtio Block Device (virtblk) Disk /dev/vda: 53,7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 53,7GB 53,7GB primary btrfs boot ...

16. März 2019 · 2 Minuten · utzer

explainshell.com

Did you know explainshell.com yet? Try it, for example with that command from last time sudo lsof -i -P -n | grep LISTEN this is an amazing web site I use often so see what commands do that I find somewhere. Try it.

16. März 2019 · 1 Minute · utzer