07-13-2006
This script run via autosys
#
HOST="machine"
IDPASSWORD="maichine.in"
LOCALDIR="lcd /xxxx/temp/"
EMAILNAMES="person's e-mail address"
LOCALMACHINE="local machine"
HOSTDIR="cd /tmp/"
TRANSFERTYPE=""
TRANSFERFUNCTION="put"
CHECKNAME=""
CHMOD="chmod 775"
FILENAME1="filename.txt"
LIST=
VENDOR=""
######################################################################
dt=`date '+%Y%m%d_%H%M'`
TMPDIR=/home/autosys/FTPlog
LOGDIR=/home/autosys/FTPlog
TMPFILE1=${TMPDIR}/`basename $0`.tmp1
TMPFILE2=${TMPDIR}/`basename $0`.tmp2
ERRFILE=${LOGDIR}/${AUTO_JOB_NAME:-`basename $0`}.err
LOGFILE=${LOGDIR}/${AUTO_JOB_NAME:-`basename $0`}.log
JOBNAME=${AUTO_JOB_NAME:-`basename $0`}
############################
#initalize log files, also done in autosys job Definition with std_out_file
cat /dev/null >${LOGFILE}
cat /dev/null >${ERRFILE}
###################################
DATE=`date +%m"/"%d"/"%y`
#
#Subroutine email_msg
#Arguements $1 - Message to send in email
#Description Send message in email
email_msg()
{
MAIL_TO_SUCC="$EMAILNAMES"
print "To:$MAIL_TO_SUCC\nSubject: $1 - $JOBNAME" | /usr/lib/sendmail -t
}
#Subroutine log_msg
#Arguements $1 - Message to write in log
#Description Write message to log file
log_msg()
{
echo "`date +'%b %d %H:%M:%S '`${HOST} $0[$$]: ${1}" >> ${LOGFILE}
}
log_msg "$0 started"
#
print "$LOCALMACHINE $JOBNAME THIS IS THE DATE=$DATE" >>${LOGFILE}
echo 'BEGINNING FTP ROUTINE...'
cat /idpass/$IDPASSWORD >$HOME/.netrc 2>> ${LOGFILE}
echo "open $HOST">${LOGDIR}/t
echo "$TRANSFERTYPE">>${LOGDIR}/t
echo "$HOSTDIR">>${LOGDIR}/t
echo "$LOCALDIR">>${LOGDIR}/t
echo "ls $LIST">>${LOGDIR}/t
echo "$TRANSFERFUNCTION $FILENAME1">>${LOGDIR}/t
echo "$CHMOD $FILENAME1">>${LOGDIR}/t
echo "ls $LIST">>${LOGDIR}/t
echo "quit" >>${LOGDIR}/t
echo "bye" >>${LOGDIR}/t
echo "" >>${LOGDIR}/t
ftp -ivd < ${LOGDIR}/t >>${LOGFILE} 2>${LOGFILE}
echo 'FTP ROUTINE HAS ENDED...'
cat /dev/null>$HOME/.netrc
I have condition checks after this
results:
Connected to machine.
220 machine FTP server (Version 1.1.214.7 Thu Aug 10 09:57:38 GMT 2000) ready.
---> USER xxxxx
331 Password required for xxxx.
---> PASS XXXXXX
230 User xxxx logged in.
---> SYST
215 UNIX Type: L8
Remote system type is UNIX.
---> TYPE I
200 Type set to I.
Using binary mode to transfer files.
---> CWD /tmp/
250 CWD command successful.
Local directory now /xxxx/temp/
---> PORT xxx.xxx.xxx.xxx,188
200 PORT command successful.
---> TYPE A
200 Type set to A.
---> LIST *
150 Opening ASCII mode data connection for /usr/bin/ls.
-rwxrwxr-x 1 xxxxx xxxxx_sys 1003779 Jun 15 09:48 filename.txt
226 Transfer complete.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am currently looking to write a script to transfer files from a windows NT server to a unix server any ideas of how to go about this? (1 Reply)
Discussion started by: chambala5
1 Replies
2. UNIX for Dummies Questions & Answers
Dear Friend,
I don't know much about unix.I am an VB6.0 Programmer.I need to move an text files as aaa.txt from unix server to windows "D: " driver using the FTP protocol.Is it possible to do this with help of unix shell script.If possible please give some sample codes.
Please answer as early... (1 Reply)
Discussion started by: gjsaravanan
1 Replies
3. UNIX for Advanced & Expert Users
Hi
There is a requirement for me to transfer files from Unix to windows in an automation process of unix.
Please let me know is it posibble to shell scripting this?
Could you help me in scripting it?
Regards
Venugopal (2 Replies)
Discussion started by: venu_eie
2 Replies
4. UNIX for Advanced & Expert Users
Hi ,
I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the forum i... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies
5. Shell Programming and Scripting
Hi,
I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.
Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files
from windows to unix box.When I searched in the... (10 Replies)
Discussion started by: kavithakuttyk
10 Replies
6. Shell Programming and Scripting
I have to transfer a file from unix to windows through Shell Script. I am using the below script, but it is not working. Please help. Please note --- I have to transfer the file from unix to windows. Not from windows to unix. I mean I don't have to use batch script.Only through unix shell script.... (1 Reply)
Discussion started by: vsachan
1 Replies
7. Shell Programming and Scripting
Hi experts,
can anyone suggest me on the below:
how to write a shell script to search and delete files on windows server.
-script runs on unix box
-it should search for specific files on windows server and delete them periodically. (2 Replies)
Discussion started by: chpradeepch
2 Replies
8. Windows & DOS: Issues & Discussions
Hi,
Objective is to transfer files from windows server to Unix server using cygwin.
I have installed cygwin, and I manually execute commands and transfer files from windows to unix using sftp. These are steps I execute
1) Run cmd
2) Run cygwin
3) At prompt type sftp user1@uniserver
4) lcd... (2 Replies)
Discussion started by: wahi80
2 Replies
9. Shell Programming and Scripting
Hi All
Please can you help, I´ve wrote the following script on a solaris 10 server to transfer files to a windows machine.
#!/usr/bin/sh
cd /moneta_polled01/download
HOST=10.100.4.72
USER=user1
PASSWD=V7stop
/usr/bin/ftp -v $HOST <<EOF
user $USER $PASSWD
cd tmp
binary
put... (7 Replies)
Discussion started by: fretagi
7 Replies
10. Shell Programming and Scripting
Hi
Please can you tell me what could be wrong with the following scriptto transfer files from solaris 10 to windows machine:
#!/bin/sh
HOST=<IP>
USER=administrator
PASSWD=xyz123zyx
/usr/bin/ftp -inv <<EOF
connect $HOST
user $USER $PASSWD
cd Documents
binary
mput *.sh
bye
EOF (23 Replies)
Discussion started by: fretagi
23 Replies
LEARN ABOUT LINUX
npm-run-script
NPM-RUN-SCRIPT(1) NPM-RUN-SCRIPT(1)
NAME
npm-run-script - Run arbitrary package scripts
SYNOPSIS
npm run-script <command> [--silent] [-- <args>...]
alias: npm run
DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts.
run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package
are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts.
As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is
used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your
script:
npm run test -- --grep="pattern"
The arguments will only be passed to the script specified after npm run and not to any pre or post script.
The env script is a special built-in command that can be used to list environment variables that will be available to the script at run-
time. If an "env" command is defined in your package, it will take precedence over the built-in.
In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by
locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your
package, you should write:
"scripts": {"test": "tap test/*.js"}
instead of
"scripts": {"test": "node_modules/.bin/tap test/*.js"}
to run your tests.
The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it
is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of `
https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration.
Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your
script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full
path you were in when you ran npm run.
npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is
passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the
default in npm v3), this is only performed when that node executable is not found in the PATH.
If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in
case you've forgotten.
You can use the --silent flag to prevent showing npm ERR! output on error.
You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially
undefined scripts without breaking the execution chain.
SEE ALSO
o npm help 7 scripts
o npm help test
o npm help start
o npm help restart
o npm help stop
o npm help 7 config
January 2019 NPM-RUN-SCRIPT(1)