How can i run the shell script from ABAP programming language


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i run the shell script from ABAP programming language
# 22  
Old 06-24-2011
Man Page for scp (All Section 0) - The UNIX and Linux Forums
Sorry about the width, but this web site goes beserk with some symbols, in code space, where it is supposed to butt out:


Code:
scp user1@host1:relative_or_full_path_of_source_files_or_dirs  [ user2@host2:relative_or_full_path_of_source_files_or_dirs . . . ] user_t@host_t:relative_or_full_path_of_target files_or_dirs

Much like cp, mv, rcp:
  • You can move one item(subtree) and change the entry name(top dir name) in the process.
  • if the target is a dir, you can have many sources: different user or host or path.
  • if the target is a dir, you can move whole subtrees with -r. For repeatability, it is best to move subtrees, without renaming, to either an absolute path or a target that will be the parent dir. Else, there can be target/source/ and target/source/source/ ! For instance, "scp /usr/local/bin xxxx:/usr/local" or "cd /usr/local ; scp bin xxxx:/usr/local". No matter how often you run it, you will not create xxxx:/usr/local/bin/bin/ like a repeat of "cd /usr/local ; scp bin xxxx:/usr/local/bin".
  • you can be on a different host altogether from sources and target!
  • has -p to preserve timestamps, ownership and permissions (but it can make problems if different user or group, source to target).
  • -C or similar adds compression, also nice for the network and for big move speed or multiple parallel copies, especially if the sending side is CPU rich. For real speed freaks with slow networks, I achieve the same effect as scp -C using more CPUs and my coice of compression with:
    Code:
    find ... | cpio -oaH crc | bzip2 -9 |ssh that_host 'bunzip2 | cpio -idmH crc '

    Then, I have a dumb demux tool xdemux.c or dumux.c to allow dividing the file list for N parallel runs (I like 2 x sending system CPU count, extras are OK as they deal with imbalance), but sometimes ssh gets sick from too much pressure on startup or too many sessions. On a secure network you can use rsh/remsh and save the encrypton costs:
    Code:
    find ... | xdemux 8 "cpio -oaH crc | bzip2 -9 |ssh that_host 'bunzip2 | cpio -idmH crc ' "


Last edited by DGPickett; 06-24-2011 at 01:01 PM..
# 23  
Old 06-24-2011
Thanks for the code. I followed the same and made this code
Code:
#!/bin/bash
dir=/usr/sap/nxa/comm/interface/fico/
scp fico@share.dteenergy.com:'get_file*'$dir
for I in $dir/get_file.*
   mv $I $dir/get_file_123${I#get_file}.csv
done
uuencode $dir/get_file_123.csv $dir/get_file_123.csv.mail | mail -s "get_file_123.csv" venkat@yahoo.com; rama@yahoo.com; 
rm $dir/get_file*


Last edited by Franklin52; 07-07-2011 at 03:28 AM.. Reason: Please use code tags for code and data samples, thank you
# 24  
Old 06-24-2011
Looks like the space before scp target got lost, but that's the idea.

Why "ftp bla bla bla mget bla bla bla" when you can scp on one line?

Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.

Last edited by DGPickett; 06-24-2011 at 01:11 PM..
# 25  
Old 06-24-2011
"ftp bla bla bla mget bla bla bla" this is the one you asking with the previous code?

space before scp target got lost - i did not get you..

it is a script to automize the file transfer & send mail process.

Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.

yes we have many options to minimize the process.
# 26  
Old 06-24-2011
Code:
scp source target 
scp fico@share.dteenergy.com:'get_file*'$dir

maybe should be (without hypertexting and underlining from web site:
Code:
scp fico@share.dteenergy.com:'get_file*'  $dir

Also, '...' are overkill as the host: stifles local globbing. I like to " around $var, though, in case they develop white space or emptiness:
Code:
scp fico@share.dteenergy.com:get_file* "$dir"

Keep it simple, and you can make more complex things work!



I hate:
  1. temp and intermediate files,
  2. file name collisions,
  3. complicated file names,
  4. running out of disk space,
  5. extra latency,
  6. underutilized CPUs
and so I love all sorts of pipes.

Last edited by DGPickett; 06-24-2011 at 01:30 PM..
# 27  
Old 06-24-2011
yes the single ' can be overkill but shouldn't hurt. The " around $DIR should be fine(might be better if a path contains blanks anyway).

also, in stead of a password, you suggested me to use a private/public key pair (SSH - keygen). i am stucked here. i read the man page and understand but i am blank face(?) because not able to understanding how to use these expressions in my script? if possible, plz suggest me how could i do it? Thanks
# 28  
Old 06-27-2011
You can find articles all over, including here, on getting ssh started. Get ssh2 if you can. Some sort of ssh keygen will give you nice big tough keys. Do not put a password in the keys, or you are back in the same kettle with better security. Make sure the permissions are right on the .ssh/.ssh2 dir, wherever it is. Here, it is not in $HOME because it is a mounted NFS disk. Get the local host name to work for "ssh host_name pwd". Once you get that ssh to work paswordless, if you copy the .ssh/.ssh2 dir to a remote host using scp -rp with a password once interactively, you will be passwordless to that host, give or take an initial save of host keys.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

3. Programming

How is a new Web Development language written ?

I'm wondering how programmers develop new Web Development languages because I want to learn how everything begins from the start. Let's say I'm planning to write a new language for the Web. How do I do this? Is there anyone who knows about the way Web Development languages first appear ? I'm... (3 Replies)
Discussion started by: Anna Hussie
3 Replies

4. UNIX for Dummies Questions & Answers

Is PERL a programming language?

I need a small and simple clarification... Can someone tell me whether PERL is a programming language or not. Also, can shell scripts also considered as programming language or not. Also, please tell me the exact difference between programming language and scripting. Please help.... (3 Replies)
Discussion started by: Anjan1
3 Replies

5. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

6. Programming

c programming language

Can someone enligten me on what below program does? I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if... (8 Replies)
Discussion started by: convenientstore
8 Replies

7. UNIX for Dummies Questions & Answers

Does the programming language matters?

I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)
Discussion started by: HOUSCOUS
8 Replies
Login or Register to Ask a Question