View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Aug 25, 2008 1:50 pm 
Offline
Joined: Sun Sep 04, 2005 3:17 pm
Posts: 8
Hi all. I have my video's and music stored on a Naslite NAS. I have successfully mounted the NAS disks and all has been good.
I have now been doing my part going green and set up the NAS box to shutdown and Wake on Lan.
Now, my question is... I would like myth to send the packet to wake the NAS box when I go to the menu to access videos or music. Is there a helpful tutorial to do this??
I have searched for this, but all I can see is the other way around (waking up the myth box). I am somewhat of a newbie and have done "some" scripting, but not in the realm I am thinking I need here.
Am I on the right path in thinking I need a script to send out the packet, mount the disks, then attach this script to the menu buttons?
Any help would be appreciated.
Thanks so much!
LaDawn


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2008 10:05 pm 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
The first thing that comes to mind is to add a new menu entry to the mythtv menus called something like "Start NAS". Have this menu entry tied to a script that:

1. Pings the NAS with a magic packet to wake it up.

2. Goes into a wait state until the NAS is ready.

3. Mounts the NAS exported directories.

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2008 12:12 am 
Offline
Joined: Sun Sep 04, 2005 3:17 pm
Posts: 8
Yes thats pretty much what I was thinking, but the actual code is where I am lacking. Is there something like this around that I could use? Like just a copy-paste or something simple like that? Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2008 9:43 am 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
The script below should help. It will give the identified machine up to 200 second to respond to the ping. If your NAS responds to pings before it is ready to accept a mount request, you may need to add a final "sleep" to give it time to finish coming ready. Also, you will need to find a Linux program that can issue the WOL command -- see thiswiki to find such a program. See also this post by graysky for useful info.

Marc


Code:
#! /bin/bash
#
# $1:    IP address of name of host to wait for
# $2:    MAC address of host to wait for
#
host_ip="$1"
host_mac="$2"
num_tries=50
wait_between_tries=4
font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
#
# Modify the "echo wol" below these comments to issue a "WAKE ON LAN".
# "$host_ip" is the IP address of the machine to wake up.
# "$host_mac" is the MAC address of the machine to wake up.
#
echo wol "$host_mac"
#
# Wait until machine waits up or we timeout
#
ping -c $num_tries -i $wait_between_tries -W $wait_between_tries $host_ip
if [ $? -ne 0 ]; then
  echo "###      Unable to wake up $host_ip" | tr "#" "\n" \
   | osd_cat -f $font \
     -c white -s 3 -S black -O 1 -u black \
     --delay=3 --align=left --pos=top
  exit 1
fi
#
# If your machine responds to pings before it is able to accept a
# network mount, uncomment the sleep command below. You may need
# to modify the number of seconds.
#
# sleep 10
exit 0


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 10:29 am 
Offline
Joined: Sun Sep 04, 2005 3:17 pm
Posts: 8
Thanks for your input Marc! I worked with the code you gave me and got it working after a few tries. It would run from the command line but not within the button in Myth. It would wake the machine but not mount my drives. I finally figured out it needed permissions to run as root. I edited the sudoers file, chmod the script file, and voila! Thanks again! I'm quite proud of myself in figuring it out I'm going to try to work a bit more on the script to fit my needs but as for now its working.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 11:30 pm 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
LaDawn, glad that helped you out and congratulations on sorting through the root vs. mythtv user problem!

Marc


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu