-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdevd-backuphdd.conf
executable file
·85 lines (68 loc) · 2.34 KB
/
devd-backuphdd.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*****************************************************************
devd-config, which triggers the Pool-Backup script, when the Backup USB HDD is attached
script in /usr/local/etc/devd/ doesn't survive a reboot
so copy it to /usr/local/etc/devd/ with init-script - truenas-copy-devdconf.sh
This is the devd-rule for FreeBSD (TrueNas Core), see the file
udev-backuphdd.conf for Linux (eg TrueNas Scale or others).
*******************************************************************
DO NOT MOFIDY THIS FILE in /usr/local/etc/devd/
MODIFY IN YOUR SCRIPT LOCATION
*******************************************************************
this one also dosn't work:
so add dicrectory to: /conf/base/etc/devd.conf
place in: /root/scripts/devd/
(truenas-copy-devdconf.sh will do this steps for you)
It won't survive upgrades though...
see: https://www.truenas.com/community/threads/devd-conf-keeps-on-getting-reset-on-reboot.6100/
*******************************************************************
restart service after modifications; /etc/rc.d/devd restart
see: https://www.freebsd.org/cgi/man.cgi?devd.conf
# Version: 0.3
# Date: 17.09.2022
# Published: 05.06.2021
get information on USB device with: cat /var/run/devd.pipe
while attaching the USB-Device
OR:
usbconfig
usbconfig ugen4.2 dump_device_desc
The general syntax of a statement is:
statement priority {
substatement "value";
...
substatement "value";
};
Example:
#
# Match a USB device type
#
notify 0 {
match "system" "USB";
match "subsystem" "INTERFACE";
match "type" "ATTACH";
match "intclass" "0x0e";
action "logger USB video device attached";
};
*******************************************************************/
// *******************************
// Backup-USB HDD is attached
// *******************************
/* don't use this style, as the event is triggered more than once
notify 100 {
match "system" "GEOM";
match "subsystem" "DEV";
match "type" "CREATE";
match "cdev" "gptid/xxxxx";
action "/root/scripts/truenas-poolbackup.sh";
};
*/
// Instead use this
// External Backup HDD
notify 100 {
match "system" "USB";
match "subsystem" "INTERFACE";
match "type" "ATTACH";
match "vendor" "xxxxx";
match "product" "xxxxx";
match "sernum" "xxxxx";
action "/root/scripts/truenas-poolbackup.sh";
};