I have a backup script (using Borgmatic) I run every night, where the
target is a RAID1 array connected by a USB dock. The dock is normally
off so the script turns it on, does the backup, then turns it off
again. This is the cron entry:

# cat /etc/cron.d/borgmatic 
# Run borgmatic every day at 3am

0 3 * * * root /usr/local/bin/dock up && /usr/bin/borgmatic ; 
/usr/local/bin/dock down

The on/off script (see attached) works reliably when run from the
command line, but fails when run via cron. The journal shows the
following:

Jun 21 03:00:01 Bree CROND[25480]: (root) CMD (/usr/local/bin/dock up && 
/usr/bin/borgmatic ; /usr/local/bin/dock down)
Jun 21 03:00:01 Bree kernel: scsi 6:0:0:0: Direct-Access     ASMT     
ASM1156-PM       0    PQ: 0 ANSI: 6
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: Attached scsi generic sg4 type 0
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] 1953525168 512-byte logical 
blocks: (1.00 TB/932 GiB)
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] 4096-byte physical blocks
Jun 21 03:00:01 Bree kernel: scsi 6:0:0:1: Direct-Access     ASMT     
ASM1156-PM       0    PQ: 0 ANSI: 6
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] Write Protect is off
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] Mode Sense: 43 00 00 00
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] Write cache: enabled, read 
cache: enabled, doesn't support DPO or FUA
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: Attached scsi generic sg5 type 0
Jun 21 03:00:01 Bree kernel: sd 6:0:0:0: [sdd] Optimal transfer size 33553920 
bytes not a multiple of physical block size (4096 bytes)
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] 1953525168 512-byte logical 
blocks: (1.00 TB/932 GiB)
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] 4096-byte physical blocks
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] Write Protect is off
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] Mode Sense: 43 00 00 00
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] Write cache: enabled, read 
cache: enabled, doesn't support DPO or FUA
Jun 21 03:00:01 Bree kernel: sd 6:0:0:1: [sde] Optimal transfer size 33553920 
bytes not a multiple of physical block size (4096 bytes)
Jun 21 03:00:06 Bree kernel: sd 6:0:0:0: [sdd] Attached SCSI disk
Jun 21 03:00:07 Bree kernel: sd 6:0:0:1: [sde] Attached SCSI disk
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/degraded': Failed to open file 
“/sys/devices/virtual/block/md127/md/degraded”: No such file or directory 
(g-file>
Jun 21 03:00:07 Bree kernel: md/raid1:md127: active with 2 out of 2 mirrors
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/sync_action': Failed to open file 
“/sys/devices/virtual/block/md127/md/sync_action”: No such file or directory (>
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/sync_completed': Failed to open file 
“/sys/devices/virtual/block/md127/md/sync_completed”: No such file or direc>
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/degraded': Failed to open file 
“/sys/devices/virtual/block/md127/md/degraded”: No such file or directory 
(g-file>
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/sync_action': Failed to open file 
“/sys/devices/virtual/block/md127/md/sync_action”: No such file or directory (>
Jun 21 03:00:07 Bree udisksd[961]: Error reading sysfs attr 
`/sys/devices/virtual/block/md127/md/sync_completed': Failed to open file 
“/sys/devices/virtual/block/md127/md/sync_completed”: No such file or direc>
Jun 21 03:00:07 Bree kernel: md127: detected capacity change from 0 to 
1000069595136
Jun 21 03:00:07 Bree kernel:  md127: p1
Jun 21 03:00:07 Bree systemd[1]: Condition check resulted in Software RAID 
monitoring and management being skipped.
Jun 21 03:00:07 Bree systemd[1]: Condition check resulted in Software RAID 
monitoring and management being skipped.
Jun 21 03:00:31 Bree kernel: sd 6:0:0:0: [sdd] Synchronizing SCSI cache
Jun 21 03:00:31 Bree kernel: md/raid1:md127: Disk failure on sdd, disabling 
device. <---------------------------------*
                             md/raid1:md127: Operation continuing on 1 devices.
Jun 21 03:00:31 Bree kernel: sd 6:0:0:1: [sde] Synchronizing SCSI cache
Jun 21 03:00:31 Bree udisksd[961]: Unable to resolve 
/sys/devices/virtual/block/md127/md/dev-sde/block symlink
Jun 21 03:00:31 Bree udisksd[961]: Unable to resolve 
/sys/devices/virtual/block/md127/md/dev-sdd/block symlink
Jun 21 03:00:31 Bree udisksd[961]: Unable to resolve 
/sys/devices/virtual/block/md127/md/dev-sde/block symlink
Jun 21 03:00:31 Bree udisksd[961]: Unable to resolve 
/sys/devices/virtual/block/md127/md/dev-sdd/block symlink
Jun 21 03:00:31 Bree kernel: md: super_written gets error=10
Jun 21 03:00:31 Bree kernel: md127: detected capacity change from 1000069595136 
to 0
Jun 21 03:00:31 Bree kernel: md: md127 stopped.

The script's own log shows it timing out after 30 seconds. The marked
line never happens when the script is run directly. Neither do any of
the other error messages.

Any ideas?

poc

Attachment: dock
Description: application/shellscript

_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to