MoLoPoLY
- 6 Posts
- 8 Comments
MoLoPoLY@discuss.tchncs.deOPto
Linux Questions@lemmy.zip•Update and restart bash script after updating itself?English
1·2 months agoSyncthing is blocked, or better the ports are blocked on 3 of the hosts (and i cant open them). I can use scp, to copy files. Ports 22 and 443 are the only ports, i can use on all hosts. Additionally, i cant install new software there.
For the restart, i have found the line
exec "$(realpath $0)" "$@". Using the script directly works with that. But since the script is called from a systemd service unit, i don’t know if this break the logic. The service unit is from type oneshot and calls the script multiple times (but different parameters), like this:ExecStart=/home/username/.local/bin/script.sh variant1 ExecStart=/home/username/.local/bin/script.sh variant2 ExecStart=/home/username/.local/bin/script.sh variant3script.sh does different things, when changing the first parameter. It starts the other variants, when the current variant finishes. Now i don’t know, if restarting
/home/username/.local/bin/script.sh variant1will break the logic and the other variants will either not executed or in some unexpected schedule.
MoLoPoLY@discuss.tchncs.deOPto
Linux Questions@lemmy.zip•Lost partition table, can i trust the HDD again?English
1·2 months agoI thought it was ext4, but it seems to be ext3. A standard file system check didn’t find any errors after I restored the partition table.
It seems that this doesn’t work as expected. Please see my new post from today. I have found also the following issue https://github.com/systemd/systemd/issues/3107. According to this, a monotonic timer doesn’t survive a reboot or power off. Please correct me, if I’m wrong.
If I understand this correctly, only a onCalendar type can be used here. That’s a little bit annoying, but as of yet, I haven’t found a way around this.
Sorry, i have to ask again. I actually thought I had solved the problem. However, today I discovered that the jobs are overdue and have not been started for several days. When I display the timers with
systemctl --user list-timers, I see that the NEXT column is empty::NEXT LEFT LAST PASSED UNIT ACTIVATES - - Sun 2026-02-01 20:01:48 CET - backup.timer backup.serviceSince there is no NEXT date, the timer/service will probably not be restarted. The timer unit looks like this:
[Unit] Description="Backup to remote" [Timer] OnUnitActiveSec=3d Persistent=true [Install] WantedBy=default.targetAs you can see, I am well over the 3 days. When I call
systemctl --user status backup.timer, I get:● backup.timer - "Backup to remote" Loaded: loaded (/home/username/.config/systemd/user/backup.timer; enabled; preset: enabled) Drop-In: /home/username/.config/systemd/user/backup.timer.d Active: active (elapsed) since Fri 2026-02-13 16:53:31 CET; 7min ago Invocation: 95ae3860c50a454b98078fc2ce3eb3c5 Trigger: n/a Triggers: ● backup.serviceTo me, this looks perfectly “normal.” The only thing that puzzles me is the Active line. Why is the current date (Fri 2026-02-13 16:53:31 CET) set there and not the date on which the job last ran (Sun 2026-02-01 20:01:48 CET)? The NEXT column fills up again when I start
systemctl --user restart backup.service. The job is then executed immediately and the column is filled. However, after rebooting the laptop, the column is empty again and the job is no longer started at the given intervals.
Ahh even more possibility’s. Many thx.
OK. I think 7 day was a slightly misleading schedule :-) My bad. But yes, you are right, for 7 days, this will work fine. But i think
OnUnitActiveSec=7dis more flexible, when i change this to 12 days, 9 days and so on… I should learn to be more precise in my questions. Sorry.
Shifting the day of the week is totally fine, since i only care about days between the job executions. Many thx, then i try my luck with this.

Many thx for the hint with journald. A little bit searching gives me https://serverfault.com/questions/573946/how-can-i-send-a-message-to-the-systemd-journal-from-the-command-line
I try that tomorrow. From reading it seems to be, what I need.