<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759925#M1905</link>
    <description>The files, locally, are in the same directory. When i make the ftp i have to put 2 files in one directory and one in another.&lt;BR /&gt;About the password i know it's not very secure, but it's not so important.&lt;BR /&gt;About the ftp how can i do?&lt;BR /&gt;put p* remotedir&lt;BR /&gt;put d* remotedir&lt;BR /&gt;put pk* remotedir&lt;BR /&gt;but does the * work??&lt;BR /&gt;As i told, the files will have the same prefix but then they're different.</description>
    <pubDate>Tue, 09 Jul 2002 12:47:43 GMT</pubDate>
    <dc:creator>Tarek_1</dc:creator>
    <dc:date>2002-07-09T12:47:43Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759923#M1903</link>
      <description>Hi there.. i need to make a script that moves three files via ftp, two of which to one directory and one to another. These files should have these names:&lt;BR /&gt;-pDATE.dat&lt;BR /&gt;-DDATE.dat&lt;BR /&gt;-pkDATE.dat&lt;BR /&gt;where date is the current date. So the file has different names every day.&lt;BR /&gt;After the ftp these files should be moved to the up directory.&lt;BR /&gt;&lt;BR /&gt;My script actually is:&lt;BR /&gt;&lt;BR /&gt;SPOOLDIR=/data/files/to_send&lt;BR /&gt;BKPDIR=/data/files&lt;BR /&gt;DESTDIRMK=/data/recieved/mk&lt;BR /&gt;DESTDIROP=/data/recieved/op&lt;BR /&gt;cd $SPOOLDIR&lt;BR /&gt;FTP_FILES&lt;BR /&gt;mv *.dat $BKPDIR&lt;BR /&gt;&lt;BR /&gt;FTP_FILES ()&lt;BR /&gt;{&lt;BR /&gt;echo "####################"&lt;BR /&gt;echo "STARTING FTP SESSION"&lt;BR /&gt;echo "####################"&lt;BR /&gt;ftp -n ipaddress &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;user username password&lt;BR /&gt;ascii&lt;BR /&gt;hash&lt;BR /&gt;cd $DESTDIR&lt;BR /&gt;put .... (files in 2 directories)&lt;BR /&gt;bye &lt;BR /&gt;eof&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;My problem is how to ftp two files in one directory and the other to another directory.&lt;BR /&gt;Thanks in advance for your help.&lt;BR /&gt;Tarek&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Jul 2002 07:13:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759923#M1903</guid>
      <dc:creator>Tarek_1</dc:creator>
      <dc:date>2002-07-09T07:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759924#M1904</link>
      <description>I apologize in advance if I am not reading your question right.&lt;BR /&gt;&lt;BR /&gt;If the files should be in different directories on the remote system you could use the cd command to change to the other directory.  You could also use the put command with the absolute path on both servers (the cd commands would not be needed and you would be ensured that the file is the correct location).  However in the instance that the files are in different directories on the local system you would use the lcd command to change the local directory.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;As a note it is not a secure method to have clear text accounts and passwords in a readable script.</description>
      <pubDate>Tue, 09 Jul 2002 11:55:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759924#M1904</guid>
      <dc:creator>Daimian Woznick</dc:creator>
      <dc:date>2002-07-09T11:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759925#M1905</link>
      <description>The files, locally, are in the same directory. When i make the ftp i have to put 2 files in one directory and one in another.&lt;BR /&gt;About the password i know it's not very secure, but it's not so important.&lt;BR /&gt;About the ftp how can i do?&lt;BR /&gt;put p* remotedir&lt;BR /&gt;put d* remotedir&lt;BR /&gt;put pk* remotedir&lt;BR /&gt;but does the * work??&lt;BR /&gt;As i told, the files will have the same prefix but then they're different.</description>
      <pubDate>Tue, 09 Jul 2002 12:47:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759925#M1905</guid>
      <dc:creator>Tarek_1</dc:creator>
      <dc:date>2002-07-09T12:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759926#M1906</link>
      <description>put works with single files, so put p* won't work.  But mput p* will.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Jul 2002 14:02:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759926#M1906</guid>
      <dc:creator>Marcin Golembski_1</dc:creator>
      <dc:date>2002-07-09T14:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759927#M1907</link>
      <description>When sending files via a script it may not be a good idea to use the *.  If you plan on setting up a little code to check the output to ensure the files were transferred correctly it may not work correctly because you may be sending additional files that you didn't want to.&lt;BR /&gt;&lt;BR /&gt;However, as mentioned above, you can use the mput command within ftp to send multiple files.</description>
      <pubDate>Tue, 09 Jul 2002 14:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759927#M1907</guid>
      <dc:creator>Daimian Woznick</dc:creator>
      <dc:date>2002-07-09T14:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759928#M1908</link>
      <description>Just a note on the testing to ensure the files were transferred correctly.&lt;BR /&gt;&lt;BR /&gt;You would first send the standard output of the ftp command to a temporary file for later testing.  After the ftp session has closed you will go back and check the temp file.  This file should contain 3 instances of the successful ftp transfer message (the HPUX server I am connected to now has "Transfer complete").  You should then check the number of instances this message occurs.  If it is not 3 then an error message can be sent via e-mail, pager, etc.&lt;BR /&gt;&lt;BR /&gt;However to make these checks accurate you should ensure that only 3 files are being sent.  I would put the commands like this:&lt;BR /&gt;&lt;BR /&gt;put $SPOOLDIR/pDATE.dat $DESTDIR/pDATE.dat&lt;BR /&gt;put $SPOOLDIR/DDATE.dat $DESTDIR/DDATE.dat&lt;BR /&gt;put $SPOOLDIR/pkDATE.dat $DESTDIR/pkDATE.dat&lt;BR /&gt;&lt;BR /&gt;Also note that if this script will be scheduled to run automatically it is not necessary to include hash because that just monitors the traffic.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Tue, 09 Jul 2002 14:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759928#M1908</guid>
      <dc:creator>Daimian Woznick</dc:creator>
      <dc:date>2002-07-09T14:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759929#M1909</link>
      <description>I can't use put with filename because this changes every day, i have to use * or something like that after the prefix name.&lt;BR /&gt;In the to_send directory (locally) i only have those 3 files, nothing else... and after ftp i move the files to the up directory so the day after, when these file are generated, in the to_send directory i will only find again 3 files and so on.</description>
      <pubDate>Tue, 09 Jul 2002 14:55:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759929#M1909</guid>
      <dc:creator>Tarek_1</dc:creator>
      <dc:date>2002-07-09T14:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759930#M1910</link>
      <description>You could define one more variable in your script, say DT, based on the current system date. E.g:&lt;BR /&gt;&lt;BR /&gt;DT=`date +%Y-%m-%d`&lt;BR /&gt;&lt;BR /&gt;This would assign DT value of 2002-07-10 (the format I use; see man date for how to change it).  &lt;BR /&gt;&lt;BR /&gt;Then you could do &lt;BR /&gt;&lt;BR /&gt;put d$DT.dat remotedir&lt;BR /&gt;&lt;BR /&gt;which would result in sending file d2002-07-10.dat to remotedir.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Jul 2002 06:04:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759930#M1910</guid>
      <dc:creator>Marcin Golembski_1</dc:creator>
      <dc:date>2002-07-10T06:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759931#M1911</link>
      <description>Another way to do this is to use an ftp macro.  Macro definitions are stored in the user's .netrc file, so you can have the script generate the macro with the changing file names each day and during the ftp session just invoke the macro.&lt;BR /&gt;&lt;BR /&gt;Additionally there is a special macro type 'init' which is invoked at login, so if you define this macro name ftp will automatically run the commands in the macro for you.&lt;BR /&gt;&lt;BR /&gt;A sample .netrc file would look like:&lt;BR /&gt;machine &lt;HOSTNAME&gt;&lt;BR /&gt;login &lt;LOGIN name=""&gt;  # optional - if used ftp will login with this name&lt;BR /&gt;password &lt;CLEARTEXT&gt; # optional &lt;BR /&gt;&lt;BR /&gt;macdef init  # defines initial macro - this is run at login &lt;BR /&gt;&lt;INSERT required="" ftp="" commands="" here=""&gt;&lt;BR /&gt;             # end macro with null line&lt;BR /&gt;&lt;BR /&gt;macdef getit  # a non 'login' macro, invoked from inside ftp by typing $getit at the ftp prompt.&lt;BR /&gt;&lt;INSERT required="" ftp="" commands="" here=""&gt;&lt;BR /&gt;             # end macro with null line&lt;BR /&gt;&lt;BR /&gt;A .netrc file must be in the users home directory and have permissions of 400, obviously there are security risks if you choose to include a cleartext login and password for the remote server.&lt;BR /&gt;&lt;BR /&gt;HTH &lt;BR /&gt;&lt;BR /&gt;Steph&lt;BR /&gt;&lt;/INSERT&gt;&lt;/INSERT&gt;&lt;/CLEARTEXT&gt;&lt;/LOGIN&gt;&lt;/HOSTNAME&gt;</description>
      <pubDate>Mon, 15 Jul 2002 03:54:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759931#M1911</guid>
      <dc:creator>Stephanie Nicholls</dc:creator>
      <dc:date>2002-07-15T03:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759932#M1912</link>
      <description>Hi again.&lt;BR /&gt;I have another problem with my script. I explain how my script is made. It is composed of two parts, sql and script shell.&lt;BR /&gt;I extract data from oracle with sqlplus and this generates the three files, after that i do ftp to move this files.&lt;BR /&gt;Now if i run my script manually (sh scriptname.sh) it works fine and everything's go ok, but if i run the same script with crontab it gives me an error:&lt;BR /&gt;Message file spl&lt;LANG&gt;.msb not found&lt;BR /&gt;Error 6 initializing SQL*PLUS&lt;BR /&gt;My line in the crontab is:&lt;BR /&gt;0 3 * * * sh /tmp/myscript.sh 1&amp;gt;/tmp/myscript'date +'\%y\%m\%d''.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;Any hint?&lt;BR /&gt;Thanks again.&lt;/LANG&gt;</description>
      <pubDate>Tue, 16 Jul 2002 07:12:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759932#M1912</guid>
      <dc:creator>Tarek_1</dc:creator>
      <dc:date>2002-07-16T07:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759933#M1913</link>
      <description>cron doesn't read your login files to set the environment variables, especially PATH, you have when logged on interactively.  So a command that runs fine from the prompt may not run from cron because the environment is different.&lt;BR /&gt;&lt;BR /&gt;Run `set` command from the prompt and save the output.  Then run `set` from a script from cron and compare the output to the saved one.  I think you might see a different PATH variable and maybe some other different or missing ones on the "cron" output.  If so, try redefining those in your script.  &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Jul 2002 11:08:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/2759933#M1913</guid>
      <dc:creator>Marcin Golembski_1</dc:creator>
      <dc:date>2002-07-16T11:08:42Z</dc:date>
    </item>
  </channel>
</rss>

