2c30f9ff7f7fdf551e2a68bf95d78df75a194174
4 FS = msg_fs ? msg_fs
: "|"
5 OFS = msg_fs ? msg_fs
: "|"
6 Kfs = key_fs ? key_fs
: ":"
7 Module =
"khatus_actuate_device_add_to_automount"
11 $
2 ==
"khatus_sensor_devices" && \
17 function mount_device
(path
, cmd
, line
, lines
, line_count
, status
, i
,
19 cmd=
"udisksctl mount --block-device " path
" --no-user-interaction; echo $?"
20 while(cmd
| getline line
) {
21 lines
[++line_count
] = line
24 status = lines
[line_count
]
27 for (i=
1; i
<=line_count
; i
++) {
29 if (line ~
/^Mounted
/) {
30 split(line
, parts
, " +")
33 sub("^Mounted " path_dev
" at ", "", path_mnt
)
34 sub("\.$", "", path_mnt
)
35 alert
("low", "successfully-mounted", path_dev
" to " path_mnt
)
37 alert
("hi", "unexpected-success-line", line
)
41 alert
("hi", "failed-to-mount-device", path
)
45 function alert
(priority
, subject
, body
) {
46 # priority : "low" | "med" | "hi"
49 print("OK", Module
, "alert", priority
, subject
, body
)
This page took 0.054322 seconds and 3 git commands to generate.