Article

bbendily's picture
article
Reads:

3158

Score:
0
0
 
Comments:

1

Lazy admin, file copy...

(View Disclaimer)

So, I'm lazy and don't like clicking GUIs for some stuff and then sometimes I do.

In this case, I wanted an easier way to map drives to servers. So I wrote a wrapper script to pass my options to the Novell Linux Client command line tools.

This works for mapping drives to NetWare and Linux OES servers.

Here's my script:

nwmapper.sh

#!/bin/bash

if [ $# = 1 ] || [ $# = 2 ]; then
echo "number of arguments is $#"

if [ $1 = "DEL" ] || [ $1 = "del" ]; then
nwmap DEL /home/user/U:
else
        if [ "$2" = "" ]; then
        nwmap -d u -s $1 -v sys
        else
        nwmap -d u -s $1 -v $2
        fi
fi
else

if [ $# = 0 ]; then
echo "must pass at least 1 argument"
exit 0
else
echo "only 2 arguments can be passed"
exit 0
fi
fi

#end script

Then I call it from the command line like:

./nwmapper.sh SERVERNAME

By default it will map the U drive/folder to the SYS volume on your server. You can also specify the volume name on the command line:

./nwmapper.sh SERVERNAME VOL

And if you want to dismount/unmap:

./nwmapper.sh del

Then, I can use this for a number of uses.

For example, I've been asked to copy files to multiple servers. So I wrote another wrapper script that wraps around my script.

copyfiles.sh
#!/bin/bash
sh /home/user/nwmap-syntax.txt $1

ls -l /home/user/U/LOGIN/Banner.exe
cp /home/user/Banner.exe /home/user/U/LOGIN/Banner.exe

ls -l /home/user/U/LOGIN/Banner.exe
sh /home/user/nwmap-syntax.txt del
#end script

Then I create another file with my server names listed:

sh copyfiles.sh SERVERNAME1
sh copyfiles.sh SERVERNAME2
sh copyfiles.sh SERVERNAME3
sh copyfiles.sh SERVERNAME4

Good luck!


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

ncisrael's picture

Agree

Submitted by ncisrael on 14 June 2009 - 2:22pm.

Your lazy!

© 2012 Novell