Mam mały problem. Chyba skrypt nie montuje mi dysków z pendrive. Automatyczne montowanie mam wyłączone. Komendy uruchomione z shella działają poprawnie.
Feb 28 09:12:54 router user.debug hotplug[24149]: Attached USB device 2-2:1.0 [INTERFACE=8/6/80 PRODUCT=951/1689/100]
Feb 28 09:12:54 router user.notice root: Podlaczono Pendrive: Kingston DataTraveler SE9 4GB
Feb 28 09:12:54 router user.notice root: Montowanie /opt i /nas
Feb 28 09:12:55 router kern.notice kernel: scsi 4:0:0:0: Direct-Access Kingston DataTraveler SE9 1.00 PQ: 0 ANSI: 0 CCS
Feb 28 09:12:55 router kern.notice kernel: sd 4:0:0:0: [sda] 7831552 512-byte logical blocks: (4.00 GB/3.73 GiB)
Feb 28 09:12:55 router kern.notice kernel: sd 4:0:0:0: [sda] Write Protect is off
Feb 28 09:12:55 router kern.debug kernel: sd 4:0:0:0: [sda] Mode Sense: 0b 00 00 08
Feb 28 09:12:55 router kern.err kernel: sd 4:0:0:0: [sda] Assuming drive cache: write through
Feb 28 09:12:55 router kern.err kernel: sd 4:0:0:0: [sda] Assuming drive cache: write through
Feb 28 09:12:55 router kern.info kernel: sda: sda1 sda2
Feb 28 09:12:55 router kern.err kernel: sd 4:0:0:0: [sda] Assuming drive cache: write through
Feb 28 09:12:55 router kern.notice kernel: sd 4:0:0:0: [sda] Attached SCSI removable disk
root@router:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 19.3M 19.3M 0 100% /
devtmpfs 124.8M 0 124.8M 0% /dev
tmpfs 124.8M 384.0K 124.4M 0% /tmp
devfs 124.8M 0 124.8M 0% /dev
tmpfs 124.8M 384.0K 124.4M 0% /www/tomato.js
root@router:/tmp/home/root# /bin/mount /dev/sda1 /opt
root@router:/tmp/home/root# /bin/mount /dev/sda2 /nas
root@router:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 19.3M 19.3M 0 100% /
devtmpfs 124.8M 0 124.8M 0% /dev
tmpfs 124.8M 384.0K 124.4M 0% /tmp
devfs 124.8M 0 124.8M 0% /dev
tmpfs 124.8M 384.0K 124.4M 0% /www/tomato.js
/dev/sda1 949.6M 47.4M 854.0M 5% /opt
/dev/sda2 2.7G 52.0K 2.6G 0% /nas
root@router:/tmp/home/root#
Skrypt wygląda tak:
if [ $PRODUCT = "951/1689/100" ] then
if [ $ACTION = "add" ] then
logger "Podlaczono Pendrive: Kingston DataTraveler SE9 4GB"
logger "Montowanie /opt i /nas"
/bin/mount /dev/sda1 /opt
/bin/mount /dev/sda2 /nas
#nvram set log_file_path=/nas/log/messages
fi
if [ $ACTION = "remove" ] then
#nvram set log_file_path=/var/log/messages
logger "Odlaczono Pendrive: Kingston DataTraveler SE9 4GB"
logger "Odmonotowywanie /opt i /nas"
/bin/umount /dev/sda1 /opt
/bin/umount /dev/sda2 /nas
fi
fi
Co robię nie tak?
EdgeRouter X: EdgeOS
RT-AX56U: AsusWRT
EA6900: tbd
EA6350: tbd
|