nossd-mount

 

#!/bin/bash



# 开机挂载硬盘
# 扫描可用的磁盘设备
for device in $(lsblk -r -o NAME | grep -E "sd[a-zA-Z0-9/]+[0-9]$");
do
  # 检查设备是否已经挂载
  if ! grep -qs "/dev/$device" /proc/mounts; then
    # 确保挂载点存在,如果不存在就创建
    mount_point="/mnt/$device"
    mkdir -p "$mount_point"
    
    # 尝试挂载设备到挂载点
    mount "/dev/$device" "$mount_point"
    
    # 检查挂载是否成功
    if [ $? -eq 0 ]; then
      echo "成功挂载设备 /dev/$device 到 $mount_point"
      echo "/dev/$device $mount_point auto defaults 0 0" | sudo tee -a /home/tuoluo/mount-info.log
    else
      echo "无法挂载设备 /dev/$device 到 $mount_point,删除挂载点"
      rmdir "$mount_point" # 删除挂载失败的目录
    fi
  else
    echo "设备 /dev/$device 已经挂载"
  fi
done

# 所有挂载完成后输出退出码 0(成功)
exit 0

 

 

#!/usr/bin/env bash
result=""
for device in $(ls '/mnt' | awk '{print $1}');
do
    
    result="$result  -d,r  /mnt/$device"
 
done

#echo $result

#注意路径
./linux/client  -a xch1r95rh9au436rqal6mmyv7j7qct24ekzekw0hz7ngqf4tsw2cvncq685df7 -w tuoluo001 $result --no-benchmark --no-plotting --no-finalizing --no-plotting  --no-benchmark

 

posted @ 2024-06-26 15:14  zhihua  阅读(10)  评论(0)    收藏  举报