noob how-to questions about

Soldato
Joined
22 Oct 2002
Posts
8,458
Location
Near Cheltenham
I only dabble in linux, mainly for tweaking my QNAP NAS etc..

Since I've just got an embedded linux Media Streamer, I've needed to do a couple of things that elude my knowledge, and google isn't giving me digestable answers.. So if any kind soul could help..


1. 'joining' Directories - Something I've used Junctions for in windows, but I want to join two directories together to aggregate their contents into a read only pseudo directory? Can I do this? Or perhaps I'm remembering incorrectly, maybe I need to symlink every sub directory from both folders into my pseudo folder? In which case how do I script that? Can it be done, i.e. a 'for every folder in x..'

2. In a startup script, I want to wait until the network adapter has got an IP address (As I want to then mount some network shares to some local directories).. I use mount -t cifs //server/share /local_folder -o,username=x,password=x in a startup script, but currently, I have to use a 'sleep 60' to make sure the wireless dongle has been picked up and connected before running the mount commands.. if I could easily script it so it waits for the connection (say checks every 6 seconds upto 20 times) then it should be a bit more efficient..

Thanks..
 
Last edited:
1. Are they separate drives? I'd use LVM in this case.

2.
Code:
#! /bin/bash

main()
{
    ping -c google.co.uk > /dev/null
    if [ "$?" -eq 0 ] 
    then
        mount -t cifs //server/share /local_folder -o,username=x,password=x
    else
        echo 'waiting..';
	sleep 15
	main
    fi
}

main
 
Last edited:
1. Are they separate drives? I'd use LVM in this case.

2.
Code:
#! /bin/bash

main()
{
    ping -c google.co.uk > /dev/null
    if [ "$?" -eq 0 ] 
    then
        echo 'waiting..';
		sleep 15
		main
    else
        mount -t cifs //server/share /local_folder -o,username=x,password=x
    fi
}

main

Thanks Mike :) I'll see if I have access to lvm in this embedded version, it sounds exactly what I need from googling it!
 
I only dabble in linux, mainly for tweaking my QNAP NAS etc..

Since I've just got an embedded linux Media Streamer, I've needed to do a couple of things that elude my knowledge, and google isn't giving me digestable answers.. So if any kind soul could help..


1. 'joining' Directories - Something I've used Junctions for in windows, but I want to join two directories together to aggregate their contents into a read only pseudo directory? Can I do this? Or perhaps I'm remembering incorrectly, maybe I need to symlink every sub directory from both folders into my pseudo folder? In which case how do I script that? Can it be done, i.e. a 'for every folder in x..'

Have you looked at unionfs? That's what I would use. LVM won't do what you want, you'll need to reformat etc, and it's just not made for that... and symlinks are ugly as hell.

2. In a startup script, I want to wait until the network adapter has got an IP address (As I want to then mount some network shares to some local directories).. I use mount -t cifs //server/share /local_folder -o,username=x,password=x in a startup script, but currently, I have to use a 'sleep 60' to make sure the wireless dongle has been picked up and connected before running the mount commands.. if I could easily script it so it waits for the connection (say checks every 6 seconds upto 20 times) then it should be a bit more efficient..

Do you use networkmanager? In that case have have a look at the dispatcher in /etc/NetworkManager/dispatcher.d, all scripts in there get executed in alphabetical order with $1 = adapter name $2 = up or down. Write a small bash script for the appropriate cif mounts/umounts in both cases.

If you don't then it can be more tricky, but i'm not going to get into huge details you probably wont need!
 
Back
Top Bottom