Novell Cool Solutions

Lazy admin, file copy…



By:

May 20, 2009 1:02 pm

Reads:4,945

Comments:1

Score:Unrated

Print/PDF

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!

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Categories: Uncategorized

1

Disclaimer: This content is not supported by Novell. 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 it thoroughly before using it in a production environment.

1 Comment

  1. By:ncisrael

    Your lazy!

Comment

Lazy admin, file copy…



By:

May 14, 2009 10:51 am

Reads:2,820

Comments:0

Score:Unrated

Print/PDF

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!

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Categories: Uncategorized

0

Disclaimer: This content is not supported by Novell. 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 it thoroughly before using it in a production environment.

Comment

RSS