Im a newbie to scripting and have a small assignment. can someone please confirm if the script i have written would work fine as we dont have a test server to test
Scenario - copy 2 files from an ftp server (windows) to a linux machine (a perticular folder). run 2 different scripts (one after the other) on the 2 files to produce output files and then copy the output files into a different dir. Hope its not too complex.
here is my script.
Code:
#!/bin/bash
HOST='machine'
USER='user'
PASSWD='password'
ftp -i -n $HOST
user ${USER} ${PASSWD}
binary
cd /home/nishant
get file1
get file2
exit (from the ftp server)
script1.sh >log.log
if test "$?" != "0"; then exit 1; fi
script2.sh >log.log
if test "$?" != "0"; then exit 1; fi
cp output1 /home/nishant/done
cp output2 /home/nishant/done
exit
---------- Post updated at 07:53 AM ---------- Previous update was at 07:32 AM ----------
Hi Mod,
Not sure if my post needed tage though. Anyways, i am typing the code again with the tags.
Code:
#!/bin/bash
HOST='machine'
USER='user'
PASSWD='password'
ftp -i -n $HOST
user ${USER} ${PASSWD}
binary
cd /home/nishant
get file1
get file2
exit (from the ftp server)
script1.sh >log.log
if test "$?" != "0"; then exit 1; fi
script2.sh >log.log
if test "$?" != "0"; then exit 1; fi
cp output1 /home/nishant/done
cp output2 /home/nishant/done
exit
---------- Post updated at 07:55 AM ---------- Previous update was at 07:53 AM ----------
donno. didnt work may be
Last edited by Franklin52; 05-23-2012 at 09:48 AM..
Reason: Please use code tags
Hello,
Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code.
Thanks,
tom (7 Replies)
I was going write a script from following site.
Unix Shell Script to Execute Oracle SQL Query (link removed)
My configuration setting for oracle XE.
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=XE
but after... (4 Replies)
Hi all,
This is my Script
#!/bin/bash
current_date=`date +%d-%m-%Y_%H.%M.%S`
Date=`date +%d%m%Y`
Lfriday=`date +%d%m%Y -d last-friday`
RootPath=/var/domaincount/com
mysql zonefile<<EOFMYSQL
CREATE TABLE com$Date(domain VARCHAR(255),col2 VARCHAR(255),col3 VARCHAR(255),col4... (10 Replies)
Hi,
I need a script that validates a file header/detail/trailer. File layout is:
Header - Rec_Type|File_name|File_Date
Detail - Rec_Type|field1|field2|field3...
Trailder - Rec_Type|File_name|File_Date|Record_count
Sample Data:
HDR|customer_data.dat|20120709... (7 Replies)
Hi All,
I am very new to unix and just started to work with unix and shell scripting.I have a query anyone help would be much appreciated
I am using sun solaris OS
I want to validate a file according to its date and if validate successful then it would write the file name,size,date and... (3 Replies)
Hi,
I trust that you are well - I'm a bit new into AIX and I've been assigned a task to write a script that will always validate between our two Prod (Prod A and Prod B) environments to confirm which prod we live at. The two environments are exact replicas and this check I need to put in... (5 Replies)
Hi,
I am trying to find the script which will ask for SSL Cert and Key file name/path. The output of both should be matched and compared. If the output are same than the script final output should be Certificate Matches and if it doesn't than Output don't match.
Is there any way we can create... (0 Replies)
Hi All,
Looking forward a script with below requirement.Please let me know if any pointers.
- there is a file which contains date
- script will go inside the file and validate date is T-1 and for Friday T-3
- Send email with status
-Shell is Ksh (2 Replies)
Hi Experts,
Please advise to Write a Shell script,
To check , whether the user has access to UNIX PRODUCTION server or not?
If no, then need to provide the access to UNIX PRODUCTION server and then need to provide access to print only few FILES.
After connecting to ther server, again... (5 Replies)
Hi All;
I am struggling to write a script that validates file header.
Header file would be like below with TAB separated
TRX # TYPE REF # Source Piece Code Destination Piece Code
every time I need to check the txt file if the header was same as above fields if validation success... (6 Replies)