One abusive ignoramous wasn't enough, now we have the return of
"Mr. Woopsie-daisy".
Only one thing to do: Ignore them, and talk about Linux, until they fade away.
A user service set up on my workstation:
In ~/.config/systemd/user:
$ cat blink_daemon-env.service
[Unit]
Description=Resolve Scroll Lock LED path and write env Before=blink_daemon.service
[Service]
Type=oneshot
ExecStart=%h/bin/blink_daemon_env.sh
$ cat blink_daemon.service
[Unit]
Description=Blink Scroll Lock LED (using generated env) After=blink_daemon-env.service
Requires=blink_daemon-env.service
# Optional: only start if the generated path file exists ConditionPathExists=%t/blink_daemon.path
[Service]
Type=simple
EnvironmentFile=%t/blink_daemon.env
ExecStart=%h/bin/blink_daemon.pl ${LED_PATH}
Restart=on-failure
RestartSec=2s
[Install]
WantedBy=default.target
...and then in ~/bin:
$ cat blink_daemon_env.sh
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
# Resolve the runtime dir that maps to %t in systemd user units RUNDIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
# Find the first Scroll Lock LED brightness knob matches=(/sys/class/leds/*scrolllock/brightness)
if (( ${#matches[@]} == 0 )); then
echo "No /sys/class/leds/*scrolllock/brightness found" >&2
exit 1
fi
LED="${matches[0]}"
# Write the env + path files used by the main unit
printf 'LED_PATH=%s\n' "$LED" > "$RUNDIR/blink_daemon.env"
printf '%s\n' "$LED" > "$RUNDIR/blink_daemon.path"
$ cat blink_daemon.pl
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(nanosleep);
use IO::Socket::UNIX qw(SOCK_STREAM);
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK :mode);
use IO::Select;
our $fn_led=`eval echo /sys/class/leds/*scrolllock/brightness`; chomp($fn_led);
our $delay = 250_000_000;
our $fd_led;
our $unix_path = $ENV{'XDG_RUNTIME_DIR'} || '/tmp';
$unix_path .= '/blink_daemon';
$SIG{INT} = $SIG{TERM} = sub { unlink $unix_path; exit 0 };
umask 0077;
my $srv = IO::Socket::UNIX->new(
Type => SOCK_STREAM,
Local => $unix_path,
Listen => 128,
) || die "create/listen $unix_path: $!";
my $flags = fcntl($srv, F_GETFL, 0) || die "F_GETFL: $!";
fcntl($srv, F_SETFL, $flags | O_NONBLOCK) || die "F_SETFL: $!";
my $sel = IO::Select->new($srv);
my $counter = 0;
SVC:
while(1)
#<<<
{
my @ready = $sel->can_read(0);
for my $s (@ready)
{
while(1)
{
my $cli = $s->accept();
last unless $cli;
my $line = <$cli>;
close($cli);
chomp($line);
$counter=int($line+0);
if($counter < 0) { $counter = 0; }
}
}
blink($counter);
sleep(3);
} # SVC loop
sub blink
{
my $counter = shift || 0;
for(my $i=0;$i<$counter;$i++)
{
set_led(1);
nanosleep($delay);
set_led(0);
nanosleep($delay);
}
}
sub set_led
{
my $val = shift || '0';
open($fd_led,">$fn_led") || die("$!");
(print $fd_led "$val\n");
close($fd_led);
}
##
Then after starting the service (systemctl --user start blink_daemon),
you can write a number to it with a simple client that calls socat:
$ cat blink.sh
#!/bin/bash
if [ "$1" == "" ]
then
counter=0
else
counter=$1
fi
echo $counter | socat - UNIX-CONNECT:$XDG_RUNTIME_DIR/blink_daemon
I have a somewhat odd request. I have about 2TB of files that have
been compressed as RAR files. The majority of them have associated
PAR files as well. They are all in different directories under a
single top level directory called "compressed".
So how can I run something like "QuickPar" under Linux to traverse
the directories and automatically repair what is broken? And once
that completes, how can I do the same with the RAR files to combine
them back into their original form which is mostly PDF and mp4? Using
a gui will not work due to the number of files, directories and
having to anwer the prompts?
Any ideas?
At Sat, 18 Oct 2025 22:52:10 -0000 (UTC), pothead
<pothead@snakebite.com> wrote:
I have a somewhat odd request. I have about 2TB of files that have
been compressed as RAR files. The majority of them have associated
PAR files as well. They are all in different directories under a
single top level directory called "compressed".
So how can I run something like "QuickPar" under Linux to traverse
the directories and automatically repair what is broken? And once
that completes, how can I do the same with the RAR files to combine
them back into their original form which is mostly PDF and mp4? Using
a gui will not work due to the number of files, directories and
having to anwer the prompts?
Any ideas?
Without knowing how your tree is laid out, it's hard to knoNew Boiler Reccomendations w, but any solution
will probably use either parchive (for legacy PAR) or par2 (for PAR 2.0), along
with find and unrar.
unrar is shareware, as is rar, so you have to register it after 40 days (or so
says synaptic).
The way I'd do it is come up with a script where you can cd into one of your archive directories, run parchive (or par2), then run unrar. After you've satisfied youself that
your script is working, you can use find . -type d to get a list of directories, possibly
using -exec to run your script in each directory. Note that your script will probably
need to accept a directory name as an argument, so it can chdir there to work your par/unrar magic.
(Of course, this assumes you have just one archive per directory. If you have more
than one, your find command will have to be that much smarter...)
perl being my go-to language, I'd probably end up writing it in perl. I don't expect
others to know perl, though, because it's gone out of style...alas. But if you're feeling
adventurous, you can ask an LLM to write the script for you. (This newsreader is
written in tk/perl, and large chunks of it are output from ChatGPT5.)
Or if you want to be more modern about it, you might want to try python -- but first,
try a shell script. It may be easier than you think.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,073 |
Nodes: | 10 (0 / 10) |
Uptime: | 213:01:08 |
Calls: | 13,782 |
Files: | 186,987 |
D/L today: |
38 files (4,791K bytes) |
Messages: | 2,434,583 |