[19. April 2013] A-400 Advanced Network Setup now available | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 [21 Jan. 2013] | A-200/A-210 [10 Aug. 2012]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
How to: Setup automount for your shares
10-18-2008, 05:40 PM (This post was last modified: 10-20-2008 12:52 PM by m69bv3.)
Post: #1
How to: Setup automount for your shares
Hi,

In this tutorial we will see how to auto mount network shares at startup

Message to NMT Dev:
Please add an option to auto mount network share on next firmware.
It's not so hard to code, and will be very useful to a part of us.
I'm not saying auto mount all shares at startup for all, but let's the user decide when adding the share.

Target Users:
NMT user using any kind of "Jukebox" and need to set a direct link to a persistent share on the NMT. This how to will show how to get rid off manually entering the share before using the jukebox!

Statement:
Network shares aren't mounted at startup. The are mounted the first time you manually entering with the PCH interface.
Unless the share isn't mounted, it can't be used by jukebox.

Work Around:
Manually entering the share after every reboot.

Goal of this "How to":
Automate the mounting of all networks shares at startup.

Requirements:
  • Hard drive installed in PCH
  • Telnet Hack installed on HARD_DISK (if not see how to here)
  • FTP client (if not see here)
  • Network Shares (indeed)


How to:

First step, use your FTP client to upload "automount.sh" on the root of your hard drive (see Files section at the end of this post).
Then with your FTP client chmod 755 "automount.sh"

Connect to your PCH with telnet and edit the file "start_app.sh"
To edit this file you can use vi installed by the Telnet Hack.

To edit with vi type the command:
Code:
/share/bin/vi /share/start_app.sh

Then press "i" to enter the editing mode under vi and add this line before the telnet launch line:
Code:
/opt/sybhttpd/localhost.drives/HARD_DISK/automount.sh

Your "start_app.sh" file should look like this:
Code:
#!/bin/sh
#
#M_A_R_K_E_R_do_not_remove_me
/opt/sybhttpd/localhost.drives/HARD_DISK/automount.sh
cd /opt/sybhttpd/localhost.drives/HARD_DISK/bin/ && ./telnetd -l /bin/sh &
exit 0

Press "Escape" to exit editing mode in vi then type ":wq" to save your changes.

You cant exit telnet.

Now your PCH will auto mount your shares at startup.

How this script works?:
It's just an explanation of how the script work, no action required!!!
This section is not mandatory!

Take look at the script:
Code:
#!/bin/sh
#
echo \#\!\/bin\/sh > /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh
echo \# >> /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh
cat /tmp/netshare | grep "http://127.0.0.1:8883/smbclient.cgi?smb.cmd=mount" |  sed -e 's#http://127.0.0.1:8883/smbclient.cgi?#/opt/sybhttpd/default/smbclient.cgi #g' >>/opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh
chmod 755 /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh

/opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh > /opt/sybhttpd/localhost.drives/HARD_DISK/automount.log

exit 0

This scripts will create another script.
The first two lines creates the shebang of the new script:
Code:
echo \#\!\/bin\/sh > /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh
echo \# >> /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh

The next line will create the commands to mount the shares.
This part of the command will list all shares (hard drive, network browser, and network shares)
Code:
cat /tmp/netshare

We want to keep only the network shares:
Code:
grep "http://127.0.0.1:8883/smbclient.cgi?smb.cmd=mount"

We want to replace the "web link" with a "local path":
Code:
sed -e 's#http://127.0.0.1:8883/smbclient.cgi?#/opt/sybhttpd/default/smbclient.cgi #g'

And we output it in the script file:
Code:
cat /tmp/netshare | grep "http://127.0.0.1:8883/smbclient.cgi?smb.cmd=mount" |  sed -e 's#http://127.0.0.1:8883/smbclient.cgi?#/opt/sybhttpd/default/smbclient.cgi #g' >>/opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh

Make this script executable:
Code:
chmod 755 /opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh

Run the script:
Code:
/opt/sybhttpd/localhost.drives/HARD_DISK/automount_shares.sh > /opt/sybhttpd/localhost.drives/HARD_DISK/automount.log

Final point:

I want to greetz lundman for his telnet hack!

I hope it's help someone.
Feel free to correct me and to give me advices!

Files
Script files

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-18-2008, 10:39 PM (This post was last modified: 10-18-2008 10:41 PM by RiChaDo.)
Post: #2
RE: How to: Setup automount for your shares
To edit with vi type the command:

Code:

/share/bin/vi /share/start_app.sh
Then press "i" to enter the editing mode under vi and add this line before the telnet launch line:

Code:

/opt/sybhttpd/localhost.drives/HARD_DISK/automount.

i see # in telnet but after i put /share/bin/vi /share/start_app.sh in the line i get a lot of ~~and in the end -/share/start_app.sh 1/1 100%
what do i do now press i?

Find all posts by this user
10-19-2008, 01:17 AM
Post: #3
RE: How to: Setup automount for your shares
Great. will try it.
thanks.
Find all posts by this user
10-19-2008, 08:30 AM
Post: #4
RE: How to: Setup automount for your shares
Thanks...

Will test it when I can.
Find all posts by this user
10-19-2008, 11:27 AM
Post: #5
RE: How to: Setup automount for your shares
(10-18-2008 10:39 PM)RiChaDo Wrote:  To edit with vi type the command:

Code:

/share/bin/vi /share/start_app.sh
Then press "i" to enter the editing mode under vi and add this line before the telnet launch line:

Code:

/opt/sybhttpd/localhost.drives/HARD_DISK/automount.

i see # in telnet but after i put /share/bin/vi /share/start_app.sh in the line i get a lot of ~~and in the end -/share/start_app.sh 1/1 100%
what do i do now press i?

Can you give me the result the command:
Code:
ls /share/bin/
when you are in telnet.

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-19-2008, 12:07 PM
Post: #6
RE: How to: Setup automount for your shares
i get after entering that command:

1 ftpget md5sum nohup telnet unzip
busybox26 ftpput more printf telnetd vi
find hexdump nc rl traceroute waitstop.sh
#

Find all posts by this user
10-19-2008, 12:43 PM
Post: #7
RE: How to: Setup automount for your shares
(10-19-2008 12:07 PM)RiChaDo Wrote:  i get after entering that command:

1 ftpget md5sum nohup telnet unzip
busybox26 ftpput more printf telnetd vi
find hexdump nc rl traceroute waitstop.sh
#

It seems that the "start_app.sh" is missing. Did you see this file at the root of your hard drive?

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-19-2008, 01:35 PM (This post was last modified: 10-19-2008 01:53 PM by RiChaDo.)
Post: #8
RE: How to: Setup automount for your shares
nope only have early_start_app.sh that was generated after cgi 0.10 if i open it with notepad i have this:

#!/bin/sh
#

#M_A_R_K_E_R_do_not_remove_me
/opt/sybhttpd/localhost.drives/HARD_DISK/.user_homepage/setup_start.cgi.sh

exit 0


oke i rechecked it again now i see the start_app.sh.
checked with notepad it says:

#!/bin/sh
#

#M_A_R_K_E_R_do_not_remove_me
cd /opt/sybhttpd/localhost.drives/HARD_DISK/bin/ && ./telnetd -l /bin/sh &

exit 0
but if i check that command ''ls /share/bin/'' i dont see the start_app.sh is that correct?! but after i check my Z:drive (nmt) i see start_app.sh

Find all posts by this user
10-19-2008, 02:11 PM (This post was last modified: 10-19-2008 02:12 PM by m69bv3.)
Post: #9
RE: How to: Setup automount for your shares
(10-19-2008 01:35 PM)RiChaDo Wrote:  but if i check that command ''ls /share/bin/'' i dont see the start_app.sh is that correct?! but after i check my Z:drive (nmt) i see start_app.sh

It's ok "start_app.sh" must be located in the root of hard drive.
Make this and you will see it:
Code:
ls /share/

But i can't understand why you can't see the content of "start_app.sh" with:
Code:
/share/bin/vi /share/start_app.sh

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-19-2008, 02:30 PM
Post: #10
RE: How to: Setup automount for your shares
oke i have entered the last command and take a look at this whats next?Tongue

http://i481.photobucket.com/albums/rr176...telnet.jpg

Find all posts by this user
10-19-2008, 02:52 PM (This post was last modified: 10-19-2008 10:12 PM by m69bv3.)
Post: #11
RE: How to: Setup automount for your shares
(10-19-2008 02:30 PM)RiChaDo Wrote:  oke i have entered the last command and take a look at this whats next?Tongue

http://i481.photobucket.com/albums/rr176...telnet.jpg

Type "i" on your keyboard to active editing mode.
Go to the line beginning with "cd /opt...." with the "down arrows" on your keyboard.
Type "enter" on your keyboard.
Go to the freshly create line with a pres on the "up arrows"
Type this in this line:
Code:
/opt/sybhttpd/localhost.drives/HARD_DISK/automount.sh
Press "Escape" to quit the editing mode.

Now your file should look like this:
Code:
#!/bin/sh
#

#M_A_R_K_E_R_do_not_remove_me
/opt/sybhttpd/localhost.drives/HARD_DISK/automount.sh
cd /opt/sybhttpd/localhost.drives/HARD_DISK/bin/ && ./telnetd -l /bin/sh &
exit 0

Now type ":wq" to save changes.
You've done.

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-19-2008, 05:38 PM
Post: #12
RE: How to: Setup automount for your shares
now i only need to save the file but entering :wq at exit 0?

Find all posts by this user
10-19-2008, 06:58 PM
Post: #13
RE: How to: Setup automount for your shares
after entering i get :

:wqAlarm clock
#

HuhHuh

Find all posts by this user
10-19-2008, 07:32 PM
Post: #14
RE: How to: Setup automount for your shares
(10-19-2008 05:38 PM)RiChaDo Wrote:  now i only need to save the file but entering :wq at exit 0?

NO, did you press "echap" before entering ":wq"? :wq is a VI command, not to be inserted in the file.


(10-19-2008 06:58 PM)RiChaDo Wrote:  after entering i get :

:wqAlarm clock
#

HuhHuh
It's really weird!

Give me the output of:
Code:
cat /share/start_app.sh

'xcuse my English I'm French!
How to: Setup link to your shares for Jukebox
Find all posts by this user
10-19-2008, 08:09 PM (This post was last modified: 10-19-2008 08:14 PM by RiChaDo.)
Post: #15
RE: How to: Setup automount for your shares
well i redid everything and after the last command you send me i get:
#!/bin/sh
#

#M_A_R_K_E_R_do_not_remove_me
/opt/sybhttpd/localhost.drives/HARD_DISK/automount.sh
cd /opt/sybhttpd/localhost.drives/HARD_DISK/bin/ && ./telnetd -l /bin/sh &
exit 0
#

but i dont think # needs to be there right?!

but i see the file the way it has 2 be haha

Sweet man thnx for you''re patience but im new with vi editor but im here 2 learn right?Tongue

Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Lightbulb How to mount multiple shares without CSI Kir 2 4,287 12-26-2010 09:09 AM
Last Post: garp99
  Setup Windows 2008 NFS for Streaming with A-100 - Guide nkarnold 16 30,467 12-21-2009 09:02 AM
Last Post: chris57
  HowTo Setup Harmony Remote for use with PCH-A100 journey4712 62 45,433 04-20-2009 08:34 PM
Last Post: woutersa
  How to: Setup link to your share for jukebox m69bv3 8 16,848 04-16-2009 03:50 PM
Last Post: sorcer1
Thumbsup NFS shares on Mac OS X (Leopard) bortoni 5 23,162 02-22-2009 06:09 PM
Last Post: Nille

Forum Jump: