Script not working in Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script not working in Linux
# 1  
Old 09-18-2013
Script not working in Linux

It is working fine in HPUX, but not in LINUX.
Can you please advise how to tweak this script for LINUX?

Please help!

Code:
;rename the file to use uppercase letters
  set DCLcom = concat("mv $", filename, " $", uc_file_dir)
  call echo(DCLcom)
  set DCLlen = size(trim(DCLcom))
  set DCLstatus = 0
  call DCL(DCLcom,DCLlen,DCLstatus)

; FTP file to Specific Location
  call echo(concat("Preparing to FTP ",uc_filename,"... (",format(cnvtdatetime(curdate,curtime3),"MM/DD/YYYY HH:MM:SS;;D"),")"))

  declare cQuote     = c1 with protect,constant('"')
  declare sCommand   = vc with protect,noconstant("")
  declare iCmdStatus = i2 with protect,noconstant(0)

  set theRemoteHost = "xx.xx.xx.xx"
  set theRemoteUserName = "ANACOMP"
  set theRemotePassword = "xxxxxx"
  set theLocalDirectory = "$cer_print"
  set theRemotePath = "/FTP/Cereplex"
  set theLocalFileName = uc_file_dir
  set theRemoteFile = uc_filename


  set sCommand = concat("print ",
                        cQuote ,
                        "open ",
                        theRemoteHost,
                        "\n user ",
                        theRemoteUserName,
                        " ",
                        theRemotePassword,
                        "\n cd ",
                        theRemotePath,
                        "\nascii \n put $",
                        theLocalFileName,
                        " ",
                        theRemoteFile,
                        cQuote,
                        " | ftp -i -n")

  call echo(sCommand)

call dcl(sCommand,size(trim(sCommand)),iCmdStatus)

# 2  
Old 09-18-2013
What language is this? It doesn't look like shell script or even csh.

To 'tweak it to work in linux' you would probably want to install an interpreter for whatever language this is, to start with.
# 3  
Old 09-18-2013
I expect something like using shell script this will be close:

Code:
#rename the file to use uppercase letters
DCLcom="mv $filename $uc_file_dir"
echo $DCLcom
$DLCcom

#FTP file to Specific Location
echo "Preparing to FTP $uc_filename $(date)"

theRemoteHost="xx.xx.xx.xx"
theRemoteUserName="ANACOMP"
theRemotePassword="xxxxxx"
theLocalDirectory=$cer_print
theRemotePath="/FTP/Cereplex"
theLocalFileName=$uc_file_dir
theRemoteFile=$uc_filename


ftp -i -n <<EOF
  open $theRemoteHost
  user $theRemoteUserName
  $theRemotePassword,
  cd $theRemotePath,
  ascii
  put $theLocalFileName $theRemoteFile,
EOF

# 4  
Old 09-19-2013
Quote:
Originally Posted by Chubler_XL
ftp -i -n <<EOF
open $theRemoteHost
user $theRemoteUserName
$theRemotePassword,
cd $theRemotePath,
ascii
put $theLocalFileName $theRemoteFile,
EOF[/code]
I tried this, but I got an error
Code:
{<}Unexpected symbol found.

, so it seems << is not working here.

---------- Post updated at 09:15 PM ---------- Previous update was at 09:12 PM ----------

Quote:
Originally Posted by Daniel Gate

set sCommand = concat("print ",
cQuote ,
"open ",
theRemoteHost,
"\n user ",
theRemoteUserName,
" ",
theRemotePassword,
"\n cd ",
theRemotePath,
"\nascii \n put $",
theLocalFileName,
" ",
theRemoteFile,
cQuote,
" | ftp -i -n")

call echo(sCommand)

call dcl(sCommand,size(trim(sCommand)),iCmdStatus)
If I take out
Code:
"print ", cQuote ,

, I am getting this error, so it seems
Code:
"print ", cQuote ,

is needed.

Code:
mv $cer_print/vhvhvxxlt09182013_1_2. $cer_print/vhvhvxxlt09182013_1_2.rtf
Preparing to FTP vhvhvxxlt09182013_1_2.rtf... (09/19/2013 14:30:08)
open 10.99.248.57\n user ####### xxxxxxxx\n cd /FTP/Cereplex\nascii \n put $cer_print/vhvhvxxlt09182013_1_2.rtf vhvhvxxlt09182013_1_
2.rtf" | ftp -i -n
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file

Please advise.
# 5  
Old 09-20-2013
Q What is the local machine running the script ( OS ) and what is the remote ?
# 6  
Old 09-20-2013
try again ... without the commas in any of the lines this time ...
Code:
ftp -i -n <<EOF
open $theRemoteHost
user $theRemoteUserName
$theRemotePassword
cd $theRemotePath
ascii
put $theLocalFileName $theRemoteFile
EOF

# 7  
Old 09-20-2013
Quote:
Originally Posted by vbe
Q What is the local machine running the script ( OS ) and what is the remote ?
It is LINUX - running the script, and the destination server is Windows for FTP.
Please advise.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies

2. Shell Programming and Scripting

Mailx not working on Linux

Hi, telnet localhost 25 Trying ::1... Connected to localhost. Escape character is '^]'. 220 TechBun ESMTP Postfix This command echo "hi" | mail -v me@mycomp.com does not send mail to my inbox and i get the below output. Upon investigation i saw this log file tail -f... (3 Replies)
Discussion started by: mohtashims
3 Replies

3. Shell Programming and Scripting

Linux/bash Script only working if executed from shell prompt

Hi, maybe I'm asking a VERY dumb question, but would anybody out there tell me, why this f****** script won't work if executed as a cronjob, but works fine if executed from a shell prompt? #! /bin/bash set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin date >>... (3 Replies)
Discussion started by: beislhur
3 Replies

4. Red Hat

Linux ksh script not working in crontab

I am Not sure why following script is not capturing the counts only when using crontab !! when I run it fromt he command line it is fine ! what is missing here ! #!/usr/bin/ksh host=`uname -n` tdate=`date` userid='dbid/password' totalevents=`sqlplus -s $userid << - set timing off ... (1 Reply)
Discussion started by: mrn6430
1 Replies

5. Shell Programming and Scripting

Setuid not working in Linux as script fails to write to file.

Hi, I have the following 3 test files to test setuid bit which if it works I would like to implement in our application. However setuid doesnot seem to be having any impact on my test below.Following are the 3 files of interest in /tmp/ folder. $ ls -ltr *env* -rw------- 1 g332008 users 6... (23 Replies)
Discussion started by: waavman
23 Replies

6. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

7. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

8. Red Hat

ps not working in Linux

Hi guys, Im not a unix expert so this may be a basic question, I'm using this in solaris to get comm for oracle processes: $ ps -ef -o comm|grep pmon ora_pmon_XXXX ora_pmon_YYYY but when trying in Linux Im getting: Warning: bad syntax, perhaps a bogus '-'? See... (2 Replies)
Discussion started by: garagonp
2 Replies

9. Linux

FTP not working under Linux but working under any other OS ??? Very strange

Dear all, I am totally despaired and puzzled. Using Filezilla under Windows under the same network as our Linux servers is working. Using FTP command-line client under any of our Linux debian servers is not working ! I tried with different FTP servers -> same problem ! All commands are... (12 Replies)
Discussion started by: magix_ch
12 Replies

10. IP Networking

linux and win nt working together

I was wondering if anybody knew how to make linux and win nt and a novell server integrated there will be no workstations we are trying to get the servers together now we are currently working on Novel and NT and then we want to integrate the linux server into that. We know that we need Samba but... (3 Replies)
Discussion started by: linuxnewbie
3 Replies
Login or Register to Ask a Question