Sponsored Content
Top Forums Shell Programming and Scripting change the mode of the file after FTP Post 302409421 by shanth_chandra on Thursday 1st of April 2010 05:49:43 AM
Old 04-01-2010
change the mode of the file after FTP

Hi
I am FTPing a file to a remote server from my local server. But after I FTP it the permissions are not in executable option, I need to change the permissions of the FTPed file how can i do that. Below is my script

Code:
LOCALDIR=/batch/ediprocess
LOCAL_BACKUP_DIR/batch/ediprocessBackUp
FTPCMDFILE=//batch/cmdftp.cmd
APP_SCRIPT_DIR=/batch
FTPLOGFILE=/batch/ftpTest.log
REMOTESERVER=test.appl.com
REMOTE_DIR=/batch/ftpTest
REMOTE_USER=hello
REMOTE_PWD=abcd
chmod 777 $LOCALDIR/*.csv
echo "user $REMOTE_USER $REMOTE_PWD"   > $FTPCMDFILE
echo "cd $REMOTE_DIR"             >> $FTPCMDFILE
echo  "lcd $LOCALDIR"              >> $FTPCMDFILE
echo "chmod 777 $LOCALDIR/*.csv"   >> $FTPCMDFILE
echo "bin"                          >> $FTPCMDFILE
echo "mput *.csv"               >> $FTPCMDFILE
echo "lcd $APP_SCRIPT_DIR"            >> $FTPCMDFILE
echo "chmod 777 $REMOTE_DIR/*.csv"  >> $FTPCMDFILE
echo "bye"                            >> $FTPCMDFILE
ftp -niv  $REMOTESERVER < $FTPCMDFILE > $FTPLOGFILE
logon_succ=`grep -ci "Goodbye" $FTPLOGFILE`
if [ $logon_succ -eq 0 ]
then
  echo "Ftp to Vendor-000009 Failed " 
else
   
  echo "Ftp to Vendor-000009 successfull"
  #echo "File Name :"$Out_FileName >> $FTP_MAIL
  mv $LOCALDIR/*.csv $LOCAL_BACKUP_DIR
fi

I tried changing the permission of the remote file but i am not able to do it.

regards
Prashanth

Last edited by zaxxon; 04-01-2010 at 07:11 AM.. Reason: use square brackets instead of pointy ones when using tags ie [] not <>
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I change IP addresses in command mode...

How do I change IP addresses in command mode? i need to assign custom (non DHCP) addresses from the command line. Actually I also need to know how to change the subnet mask, the gateway and the primary, secondary, ... dns servers. (6 Replies)
Discussion started by: Super.Anyak
6 Replies

2. Shell Programming and Scripting

script to ftp file (ip change)

Hi All, If I want to ftp files from machine to local pc. But the ip must change everytime :( (due to VPN), can I write a script to easiler (no need to update ip in script)? user_name=aaa password=bbb cat ip.txt # # FTP the files # ftp -d -in 199.200.204.109 <<EOF user $user_name... (2 Replies)
Discussion started by: happyv
2 Replies

3. IP Networking

Transfering file through FTP through Binary Mode

Hi, I'm uploading files using internet explorer. 1.Open internet explorer 6.0 2.Open site like ftp://172.45.15.1 3.Copy files The files which I'm copying are basically zip files. What is the default transfer mode, I mean ASCII/BINARY ???. The problem I'm facing, while extracting these... (4 Replies)
Discussion started by: ronald_brayan
4 Replies

4. Shell Programming and Scripting

How to check a file whether it is in binay mode or not while doing ftp??

Hi, One bank statement file should be loaded into some tables by using a concurrent program. But if the file is transfered in binary mode i am getting some special characters in the file which is unexpected. so, for that while moving that file data into tables i want to write a script that... (2 Replies)
Discussion started by: sateesh.d
2 Replies

5. Solaris

FTP is in maintenance mode always

Hello All, On solaris 10 server i could see the FTP service is in maintenance mode always :mad: Could some assist? svcs -xv svc:/network/nfs/nlockmgr:default (NFS lock manager) State: maintenance since Tue 28 Jul 2009 11:47:55 AM BST Reason: Restarting too quickly. See: Sun... (5 Replies)
Discussion started by: bullz26
5 Replies

6. Shell Programming and Scripting

ftp file and change prefix

Hi, i want to ftp to another server and change the prefix of the file and change direcotry also. but i am unable to get it. any ideas will be helpful? ftp -n ${HOST} <<END quote USER $USER quote PASS $PASS cd /dir/dir put file mv file fnl.fileEND END (2 Replies)
Discussion started by: dazdseg
2 Replies

7. AIX

ftp connect in passive mode , ftp settings

how to connect to ftp server in passive mode? ftp server.abc and how can i see ftp settings, doesn't exist some ftpd.conf there is some other file where i check the options and configurations of ftp server? Thanks (3 Replies)
Discussion started by: prpkrk
3 Replies

8. Shell Programming and Scripting

one line command to change mode only if necessary

hi, sorry for posting this for a quick answer. Is there a one line command to change permissions on files in a directory to a given mode (say 554) and only for those files that do not already have that mode? Running chmod updates the last access/modified timestamp on the files, and i want to... (11 Replies)
Discussion started by: ysrini
11 Replies

9. UNIX for Advanced & Expert Users

Change mode drwxrwsr-x+ directory

Hi, How to change mode "drwxrwsr-x+" in directory. I'm able to set drwxrwsr-x but "+" is difficult to set. ~ $ las -las | grep done1 4 drwxrwsr-x+ 3 root sfuser 4096 Nov 26 16:39 done1 ~ $ getfacl done1 # file: done1 # owner: root # group: sfuser # flags: -s- user::rwx... (4 Replies)
Discussion started by: justbow
4 Replies

10. AIX

Change Param File Variable Test Mode Value

First two days of shell scripting... I've looked at awk/sed and man sed only to get off into the weeds of complexity that may not be needed here... hints for awk or sed or other method to magically change the bolded item below? Nutshell: HFTST=Y #test mode = true to false & back again so... (0 Replies)
Discussion started by: JeffPGMT
0 Replies
PHARFILEINFO.CHMOD(3)							 1						     PHARFILEINFO.CHMOD(3)

PharFileInfo::chmod - Sets file-specific permission bits

SYNOPSIS
public void PharFileInfo::chmod (int $permissions) DESCRIPTION
PharFileInfo.chmod(3) allows setting of the executable file permissions bit, as well as read-only bits. Writeable bits are ignored, and set at runtime based on the phar.readonly INI variable. As with all functionality that modifies the contents of a phar, the phar.readonly INI variable must be off in order to succeed if the file is within a Phar archive. Files within PharData archives do not have this restriction. PARAMETERS
o $permissions - permissions (see chmod(3)) RETURN VALUES
No value is returned. EXAMPLES
Example #1 A PharFileInfo.chmod(3) example <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar('brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file.sh'] = '#!/usr/local/lib/php <?php echo "hi"; ?>'; // set executable bit $p['file.sh']->chmod(0555); var_dump($p['file.sh']->isExecutable()); } catch (Exception $e) { echo 'Could not create/modify phar: ', $e; } ?> The above example will output: bool(true) PHP Documentation Group PHARFILEINFO.CHMOD(3)
All times are GMT -4. The time now is 04:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy