#!/bin/bash #サーバーのip smbserver_ip="192.168.0.101" #サーバーのMacアドレス macaddress="**:**:**:**:**:**" #ノーティファイアイコン notify_icon="/usr/share/icons/Humanity/apps/48/gksu-root-terminal.svg" ########################################## ########## 設定するのはここまで ########## ########################################## sudo etherwake $macaddress count=1 while [ 0 ]; do ping_res=$(ping -c1 $smbserver_ip) if echo $ping_res | grep -sq ", 0% packet loss" then if [ $count -ge 2 ] then sleep 15 fi mount_res=$(/usr/bin/nautilus smb://$smbserver_ip/) if [ -z $mount_res ] then notify-send -i $notify_icon 'Mounted SMB drives Now' && aplay "/usr/share/sounds/Media/notify.wav" >/dev/null 2>&1 else notify-send -i $notify_icon $mount_res && aplay "/usr/share/sounds/Media/notify.wav" >/dev/null 2>&1 fi exit else if [ $count -ge 30 ] then notify-send -i $notify_icon "I can't find the server." && aplay '/usr/share/sounds/Media/Uh oh.wav' >/dev/null 2>&1 exit fi let ++count fi done