• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

Script for mounting Linux partition on Windows 2000

Dear Experts

Hi! I am stuck here for a solution, I am having a small ISP, I have configured mrtg graphs on my Linux machine which also happens to be my mail-server, I dont want any X-Interface on my mail-server, also I am having a windows-2000 server running, which is my web and dns. I want to show the mrtg graphs on the web-site and hence would be required to mount the linux partition on windows and every 5 minutes upgrade it so that I can show the current mrtg status.

please help me....

thanks in advance

smiles

sid
0
sidheart
Asked:
sidheart
  • 7
  • 4
  • 3
  • +3
1 Solution
 
JivkoCommented:
You can not access linux partition from Windows.
Why do not use MRTG for Windows?

Regards
0
 
sidheartAuthor Commented:
Dear Jivko

I am running mrtg on Linux, i want the graphs to be published on the net, my dns and web server is a win2k machine......

Thanks in adavance Jivko

Siddharth
0
 
JivkoCommented:
You can use SAMBA to make MRTG grafs and .png-s accesible for your Windows2k machine.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
sidheartAuthor Commented:
Dear Jivko

I am running mrtg on Linux, i want the graphs to be published on the net, my dns and web server is a win2k machine......

Thanks in adavance Jivko

Siddharth
0
 
sidheartAuthor Commented:
Dear Jivko

I totally agree upon running SAMBA on the linux server.....but my sysadmin wont let me do that, thats why i think a shell script for mounting a linux partition on windows and then updating it every 5 mins to get the current status and showing the graphs.

ragards

siddharth
0
 
JivkoCommented:
Again
You can not access linux partition from Windows OS without SAMBA.
Also you can not mount linux partition in Windows without SAMBA.

Regards
0
 
djluffCommented:
The easiest way to move the files with the software you already have would be to enable the FTP server on your windows machine, and have the linux machine FTP the files to it every time they're updated.

Or, the most secure way would be to use SSH/SCP. but this needs extra software on windows.

Other alternatives are:
- rcp (An rcp command used to come with NT 4 - in the resource kit I think).

- rsync (most efficient - only copies changes. needs extra software for windows)

Or, you could put apache on the linux server and use the windows machine as a reverse proxy. So you dont need to copy anything then.
0
 
sidheartAuthor Commented:
Dear DLUFF

Yes thats exactly what I am looking for, I need to write a shell script so that I can Move files after every update of the mrtg graphs.......please help me on this....but hats off you have a solution working here for me...also what extra software do I need for windows here?

0
 
djluffCommented:
To use FTP pushed from a script on the Linux end, you just need an FTP server at the windows end, which you should already have in IIS, and an FTP client like ncftp installed on the linux end (should be already there).

So:
- enable FTP server on your windows machine (if its not already)

- Create a directory to receive the files (eg. d:\mrtg)

- create a virtual Web directory for d:\mrtg that shows up to the web users as "/mrtg" or whatever mrtg likes.

- create an FTP virtual directory for d:\mrtg that shows up as /mrtg for ftp users

- create a user account on the windows machine (say 'mrtg')

- give the 'mrtg' user NTFS and FTP write access to the d:\mrtg directory.

- write the script at the linux end to use 'ncftpput' or something to copy the files:

ncftpput -R -f login.cfg /usr/local/mrtg/* /mrtg
(or wherever the files are)

for ncftpget, the 'login.cfg' file contains:
host  web.server.name
user  mrtg
pass  whateverthepasswordis


I believe that you need to leave the files on the linux machine, as well as copying them to the windows server, because mrtg stores historical data there to let it calculate stats??

A couple of security items:
- If you're not using the FTP server for anything else, I'd apply IP restrictions so that only the linux machine has access.

- only give the 'mrtg' user access to the 'd:\mrtg' directory and nothing else. remember that ftp passes the username/password in the clear

- if it's at all security sensitive, you could consider using SSH rather than FTP, but this would need extra windows software.
0
 
aceventuraCommented:
Hi Sid,

From what I see, you need to transfer files from your
Linux box to your Win2K machine at periodical intervals.

What I'd suggest is
1. Get Expect (http://expect.nist.gov/)
2. Plug Expect into TCL (assuming you have TCL installed).
3. Using Expect you can write a script to FTP to your
   linux box and "get" the files of your choice back to
   your Win2K machine.
4. Now you do what you want with those files. You could
   have a batch file or even a TCL script that picks
   up the file on your W2K machine at intervals and
   performs some action.

Expect basically can be used to automate tasks - the kind
you are looking at. It is basically a set of SEND and
EXPECT requests. Ive used it successfully to automate
telnet and ftp sessions to get my work done.

Hope it helps.

Ashish
0
 
sidheartAuthor Commented:
Dear Ashish

Thanks , can I use scp script if I implement a SSH server on linux and a client on the windows machine.

I am trying to implement DJLUFF solution tooo.

The restriction I have is that I dont want any X-interfaces on my linux machine.
What are the options that I can give to scp for transferring files automatically on windows and then updating again after some time.

Ashish can you please be a bit elobrotive on the script that you have implemented.

thanks in advance

siddharth
0
 
sidheartAuthor Commented:
Dear Experts

I have tried using ncftpput
through

ncftpput -R -f login.cfg /inst/mrtg/webroot/ /mrtg

where I have made a file login.cfg
and my png files are in directory webroot and destination id /mrtg

I am getting an error:

login.cfg : name or service not known
cannot recover from micellaneous open error -105.
ncftpput: cannot open /login.cfg: unkown host

please help

0
 
aceventuraCommented:
Hi Sid,

Sorry for the delay in replying. Have been really busy.
Part of life eh ?

What I was talking about is something very basic.

You want to get you graphs from your Linux machine to your
Win2K machine at regular intervals right.

As mentioned earlier, you could automate this task using
Expect.

From your Win2k machine execute a script similar to the
following

# script starts
package require Expect

set FILE   "<filename>"
set WIN2K  "<IP ADDRESS>"

set timeout 60
spawn ftp $WIN2K
expect "User(*):"
send "<username>\r"
expect "Password:"
send "<password>\r"
expect "ftp>"
send "binary\r"
expect "ftp>"
send "cd <directory_where_file_is>\r"
expect "550*ftp>" exit "250*ftp>"
send "get <file_you_want_to_get>\r"
expect "550*ftp>" exit "200*150*226*495*ftp>"
bye

# script ends

Now the file has reached your Win2k machine. Either you
write another script that calls this script to get
the file at intervals (you can use "after" in a while
loop) and then the file is yours to do what you want.

Ashish

0
 
aceventuraCommented:
Instead of using two scripts, you might find it easier
to handle one script.
You could put the code to ftp in a proc and then

while {1} {
       
     after 5000 { get_file }
     # now the file is in your current dir
     # it's yours to do what you want

}

You could also use mget instead of get while ftp-ing if
you want to get multiple files.

Hope it helps

Ashish
0
 
aceventuraCommented:
Boss,

Any luck ?
Just curious.

Ashish
0
 
sidheartAuthor Commented:
Dear Ashish

Hi! Hello! how are you? I am extremely sorry , I was on deputation and just saw your mail. I finally installed apache webserver and wrote an entry in cron and init.d to automate the process.

Will bother you for help on mrtg which I am stuck with ...

Best wishes and kind regards

Siddharth
0
 
CleanupPingCommented:
sidheart:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
SpazMODicCommented:
PAQed - no points refunded (of 250)

SpazMODic
EE Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 4
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now