1 |
On 01/10/2021 22:54, Canek Peláez Valdés wrote: |
2 |
> On Fri, Oct 1, 2021 at 3:37 PM antlists <antlists@××××××××××××.uk |
3 |
> <mailto:antlists@××××××××××××.uk>> wrote: |
4 |
> |
5 |
|
6 |
> |
7 |
> I think it would be much simpler to have a Type=oneshot service at boot, |
8 |
> and the Exec= line to call a script. You can store the timestamp of the |
9 |
> last time it was called someplace in the filesystem (say, |
10 |
> /var/lib/my-script or something), and if the timestamp doesn't exists or |
11 |
> is older than one week, the scripts executes lvm snapshot and updates |
12 |
> the timestamp; otherwise it ends without doing anything. |
13 |
|
14 |
Ouch. Dunno if that would work. Bear in mind I'm running this BEFORE |
15 |
fstab, so / is read-only ... |
16 |
> |
17 |
> The timer units are very similar to cron, and I believe what you want |
18 |
> cannot be done with cron either; you need special logic and state ("I'm |
19 |
> booting AND haven't run this in at least a week"), so a script is |
20 |
> necessary (I think). Luckly, systemd allows you to smartly manage your |
21 |
> scripts and impose dependencies on them (you need /var in my example, |
22 |
> and you can set it to run before starting X). |
23 |
> |
24 |
I will have to see if the timer can set up the oneshot service, and if |
25 |
it really is one shot per activation ... |
26 |
|
27 |
Cheers, |
28 |
Wol |