scripting problem (client / server files) HELP!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scripting problem (client / server files) HELP!!!
# 1  
Old 07-24-2003
scripting problem (client / server files) HELP!!!

can anyone help with the following scripting problem:
i need these implemented so the client can perform the tasks in the menu on the files.

Client Script
--------------

echo " select any option to execute:"
echo " c or C: To connect Client to Server"
echo " r or R: To make a read request"
echo " s or S: I want to sort data"
echo " g or G: Look for a certain word in a file"
echo " e or E: quit"
echo -n "Enter your option and press :"
set selection = `head -1`

switch ("$selection")
case [cC]:
echo -n "enter server name"
set servername = `head -1`
find $servername
breaksw

case [rR]:

cp
echo -n "enter server file to read content"
set serverfile = `head -1`
breaksw

case [sS]:

sort
echo -n "enter server file to sort"
set serverfile1 = `head -1`
breaksw

case [qQ]:

exit 0

breaksw

default:

case [qQ]:

exit 0

breaksw

default:
echo " wrong option."
exit 1
breaksw
endsw
exit 0


--

Server script
--------------

if (($servername[1] == option1)) then
set servername =``
echo "main server is connected" >> ./monitor/serverlock
echo "main server is connected"
endif

if ($argv[1] == 'option4') then
echo -n "enter file to search:"
set datafile = `head -1`
echo -n "enter word or data to search:"
set data = `head -1`
echo ""
echo -n $data
echo -n $datafile
grep -i $data $datafile
echo ""
echo ""
endif

if (($argv[1] == option2)) then
echo -n "enter file to read:"
set datafile = `head -1`
if (($datafile == course)) then
cat course && cat course> ServerMaster1
echo "read the course file" >> ./monitor/courselock
else if (($datafile == student)) then
cat student && cat student > ServerMaster2
echo "read the student file" >> ./monitor/studentlock
else if (($datafile == exam)) then
cat exam && cat exam > ServerMaster3
echo "read the exam file" >> ./monitor/examlock
endif
endif

if ($argv[1] == 'option3') then
echo -n "enter file to sort:"
set datafile = `head -1`
if (-e $datafile) then
sort $datafile
echo -n "server sorted"
end if
endif


I also have .csh files named student, exam and course 25 records in each.


Cheers
# 2  
Old 07-25-2003
See number six -

Quote:
Client Script
--------------

echo " select any option to execute:"
echo " c or C: To connect Client to Server"
echo " r or R: To make a read request"
echo " s or S: I want to sort data"
echo " g or G: Look for a certain word in a file"
echo " e or E: quit"
echo -n "Enter your option and press :"
set selection = `head -1`

switch ("$selection")
case [cC]:
echo -n "enter server name"
set servername = `head -1`
find $servername
breaksw

case [rR]:

cp
echo -n "enter server file to read content"
set serverfile = `head -1`
breaksw

case [sS]:

sort
echo -n "enter server file to sort"
set serverfile1 = `head -1`
breaksw

case [qQ]:

exit 0

breaksw

default:

case [qQ]:

exit 0

breaksw

default:
echo " wrong option."
exit 1
breaksw
endsw
exit 0


--

Server script
--------------

if (($servername[1] == option1)) then
set servername =``
echo "main server is connected" >> ./monitor/serverlock
echo "main server is connected"
endif

if ($argv[1] == 'option4') then
echo -n "enter file to search:"
set datafile = `head -1`
echo -n "enter word or data to search:"
set data = `head -1`
echo ""
echo -n $data
echo -n $datafile
grep -i $data $datafile
echo ""
echo ""
endif

if (($argv[1] == option2)) then
echo -n "enter file to read:"
set datafile = `head -1`
if (($datafile == course)) then
cat course && cat course> ServerMaster1
echo "read the course file" >> ./monitor/courselock
else if (($datafile == student)) then
cat student && cat student > ServerMaster2
echo "read the student file" >> ./monitor/studentlock
else if (($datafile == exam)) then
cat exam && cat exam > ServerMaster3
echo "read the exam file" >> ./monitor/examlock
endif
endif

if ($argv[1] == 'option3') then
echo -n "enter file to sort:"
set datafile = `head -1`
if (-e $datafile) then
sort $datafile
echo -n "server sorted"
end if
endif


I also have .csh files named student, exam and course 25 records in each.
Have you asked for help from your instructor?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting to transfer files from one to another server through ftps

Hi Guyz ,, I'm an ERP functional guy , I really need to automate a script which required a shell script but have a little knowledge in shell scripting. I need my generated files to be zipped first in one directory lets say (xyz) and then it needs to transfer another ftp server in... (3 Replies)
Discussion started by: Shogundion
3 Replies

2. Shell Programming and Scripting

Sftp script for dev server to client server

hi, i am new to unix, cuold u send some sftp acripts to send files to dev server to clint server, (1 Reply)
Discussion started by: Koti.annam
1 Replies

3. Programming

kill() function problem in client-server ipc message using 2 FIFOs

I want to have a message send & receive through 2 uni-direction FIFO Flow of data FIFO1 stdin--->parent(client) writefd--->FIFO1-->child(server) readfd FIFO2 child(server) writefd2---->FIFO2--->parent(client) readfd2--->stdout I need to have boundary structed message... (3 Replies)
Discussion started by: ouou
3 Replies

4. Programming

please help a problem in client-server ipc message 2 pipes communication simple example

I want to have a message send & receive through 2 half-duplex pipes Flow of data top half pipe stdin--->parent(client) fd1--->pipe1-->child(server) fd1 bottom half pipe child(server) fd2---->pipe2--->parent(client) fd2--->stdout I need to have boundary structed message... (1 Reply)
Discussion started by: ouou
1 Replies

5. Windows & DOS: Issues & Discussions

Office server => laptop =>client server ...a lengthy and laborious ftp procedure

Hi All, I need your expertise in finding a way to solve my problem.Please excuse if this is not the right forum to ask this question and guide me to the correct forum,if possible. I am a DBA and on a daily basis i have to ftp huge dump files from my company server to my laptop and then... (3 Replies)
Discussion started by: kunwar
3 Replies

6. UNIX for Dummies Questions & Answers

Sync files between unix client and windows 2003 server

Hi everybody... I want to sync files between unix client machine and windows 2003 server machine. I thought of using Cygwin for windows server and then rsync between two to sync files, but have come to know that might be Cygwin will not be able to handle multiple clients request.... Can any... (2 Replies)
Discussion started by: lokeshsingla
2 Replies

7. Programming

Client/Server Socket Application - Preventing Client from quitting on server crash

Problem - Linux Client/Server Socket Application: Preventing Client from quitting on server crash Hi, I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64. I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Discussion started by: varun.nagpaal
2 Replies

8. Programming

Server - Client application problem

hi all I'm beginner in CORBA Server-Client appliction development. My server- client application was worked well and i have tested it too. Due to some Network problem we have rebooted our dedicated server , then i restart my corba service, application in the server it started... (0 Replies)
Discussion started by: VijayakumarN
0 Replies

9. Solaris

Secure FTP Problem using Sun SSH on Client system F-Secure on Server system

I am using shell script to do secure ftp. I have done key file setup to do password less authentication. Following are the FTP Details: FTP Client has Sun SSH. FTP Server has F-Secure. I am using SCP Command to do secure copy files. When I am doing this, I am getting the foll error scp:... (2 Replies)
Discussion started by: ftpguy
2 Replies

10. Linux

MSN client that allows scripting

Would any of you know if there are any Linux (and/or BSD) MSN-clients that make it possible to send messages from shellscripts? When I search sourceforge I get lots of hits, but none of these really advertise this ability. I would like to have my servers send me a message when certain events... (0 Replies)
Discussion started by: indo1144
0 Replies
Login or Register to Ask a Question