<?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: Shell Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450622#M208745</link>
    <description>If you not good in scripting. &lt;BR /&gt;read some doc and after that if you can not find  way we will tell you :))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;read &lt;BR /&gt;#man cron&lt;BR /&gt;#man bash&lt;BR /&gt;</description>
    <pubDate>Mon, 27 Dec 2004 03:58:49 GMT</pubDate>
    <dc:creator>Ivajlo Yanakiev</dc:creator>
    <dc:date>2004-12-27T03:58:49Z</dc:date>
    <item>
      <title>Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450621#M208744</link>
      <description>Dear All,&lt;BR /&gt;&lt;BR /&gt;i need to implement the following shell scripts and since i am not that good in scripting so i can explain the idea of the scripts and can someone help me get them done.&lt;BR /&gt;&lt;BR /&gt;first script:&lt;BR /&gt;create script to run from the cron tab every 5 min to check on the availability of another machine (ping) and in case the ping is not working then this other machine is not live, so change the IP of the running machine to the IP of the failed machine then set a flag that the backup machine is running, so as you will check on it next time the cron tab is perfomrning the script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Second Script:&lt;BR /&gt;&lt;BR /&gt;the idea is i need to make a backup from one machine, move it to another machine in a specified location, then perform the unbackup on the other machine.&lt;BR /&gt; &lt;BR /&gt;on one machine, i will do something like backup or copy for some folders and files, then i need to copy or ftp or whatever the way to the other machine, in a specific location on this other machine, then i would unbackup, or if i am doing cpy then no operation will be done, i need to do this also in the cron tab every one day and every one week.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks</description>
      <pubDate>Mon, 27 Dec 2004 03:45:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450621#M208744</guid>
      <dc:creator>Ahmed_41</dc:creator>
      <dc:date>2004-12-27T03:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450622#M208745</link>
      <description>If you not good in scripting. &lt;BR /&gt;read some doc and after that if you can not find  way we will tell you :))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;read &lt;BR /&gt;#man cron&lt;BR /&gt;#man bash&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Dec 2004 03:58:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450622#M208745</guid>
      <dc:creator>Ivajlo Yanakiev</dc:creator>
      <dc:date>2004-12-27T03:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450623#M208746</link>
      <description>Hi Ahmed,&lt;BR /&gt;It is advisable to learn some shell scripting first becuase even if any one gives you the readymade script then also you need to customize it according to your environment and even maintain it further.&lt;BR /&gt;To start with you can go thr' korn shell scritping on the link below and once you are familiar with korn then it makes little difference with other shells.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hk8.org/old_web/unix/ksh/index.htm" target="_blank"&gt;http://www.hk8.org/old_web/unix/ksh/index.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also you can learn perl programming which is the most powerful scripting laguage. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hk8.org/old_web/perl/learn/index.htm" target="_blank"&gt;http://www.hk8.org/old_web/perl/learn/index.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&lt;BR /&gt;Regards,&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Dec 2004 04:21:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450623#M208746</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-12-27T04:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450624#M208747</link>
      <description>Hi Ahmed,&lt;BR /&gt;as far ur first script is concerned,i couldn't get the idea of changing IP..&lt;BR /&gt;i use a script to continually check/ping all my machines in LAN...&amp;amp; i have kept it in cron..&lt;BR /&gt;scrip name: pingcheck&lt;BR /&gt;#! /bin/sh&lt;BR /&gt;(first to check whether cron deamon is running or not)&lt;BR /&gt;vard=`ps -aef | grep -v grep | grep cron | wc -l`&lt;BR /&gt;if [ $vard = 0 ]&lt;BR /&gt;then&lt;BR /&gt;logger -p daemon.notice "ERROR: Cron Daemon Killed "&lt;BR /&gt;fi&lt;BR /&gt;(second keep a ping to other hosts)&lt;BR /&gt;&lt;BR /&gt;ping 137.xx.xx.xxx -n 4 &amp;gt;cpr&lt;BR /&gt;cat cpr | grep -v 64 | grep -v Statistics | grep  "0%" | grep -v "round" &amp;gt;cpr1&lt;BR /&gt;var=`cat cpr1 | awk ' { print $4 }'`&lt;BR /&gt;if [ $var = 0 ]&lt;BR /&gt;then&lt;BR /&gt;logger -p user.err "ERROR: Cannot reach 137.xx.xx.xxx(New host Connectivity)"&lt;BR /&gt;fi&lt;BR /&gt;(check errors in /var/adm/syslog/syslog.log)&lt;BR /&gt;u can extend this script for as many hosts in ur LAN.&lt;BR /&gt;&lt;BR /&gt;u can keep this script in cron to check for every 15 mins for 6 working days..&lt;BR /&gt;# crontab -l&lt;BR /&gt;&lt;BR /&gt;00,15,30,45 06-23 * * 1-6 /home/ahmed/pingcheck&lt;BR /&gt;&lt;BR /&gt;[of course u can modify ur crontab :)]&lt;BR /&gt; &lt;BR /&gt;------------------------------------------&lt;BR /&gt;for the second script:&lt;BR /&gt;it can look like this:&lt;BR /&gt;scrip name: f3&lt;BR /&gt;&lt;BR /&gt;#! /bin/sh&lt;BR /&gt;cd /dumps/dbdump&lt;BR /&gt;ls * &amp;gt;/home/ahmed/f3_tmp&lt;BR /&gt;&lt;BR /&gt;##########################################&lt;BR /&gt;for file in `cat /home/ahmed/f3_tmp`&lt;BR /&gt;do&lt;BR /&gt;echo $file&lt;BR /&gt;sleep 2&lt;BR /&gt;HOST='137.xx.xx.xx'&lt;BR /&gt;USER='ahmed'    )user name &amp;amp; password are&lt;BR /&gt;PASSWD='xxxxxx' )hardcoded&lt;BR /&gt;FILE=`echo $file`&lt;BR /&gt;ftp -n $HOST &amp;lt;&lt;END_SCRIPT&gt;&lt;/END_SCRIPT&gt;&lt;BR /&gt;quote USER $USER&lt;BR /&gt;quote PASS $PASSWD&lt;BR /&gt;bin&lt;BR /&gt;cd /dumps/dbdump&lt;BR /&gt;put /dumps/dbdump/$FILE&lt;BR /&gt;&lt;BR /&gt;quit&lt;BR /&gt;END_SCRIPT&lt;BR /&gt;&lt;BR /&gt;#exit 0&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;u can keep this script in cron too..&lt;BR /&gt;&lt;BR /&gt;#crontab -l&lt;BR /&gt;00 18 * * 1-6 /home/ahmed/f3&lt;BR /&gt;&lt;BR /&gt;hope this helps..if not then don blame me:D&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ABHIK &lt;BR /&gt;</description>
      <pubDate>Mon, 27 Dec 2004 05:06:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450624#M208747</guid>
      <dc:creator>abhijeet_7</dc:creator>
      <dc:date>2004-12-27T05:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450625#M208748</link>
      <description>Ahmed:&lt;BR /&gt;Using ping to check the availability of a system is not a good idea.  It is too low in the IP stack.  It is possible for a system that is completely hosed to still respond to a ping.  &lt;BR /&gt;Better is to use remsh or secure shell or something else that requires the remote system to actually do something:&lt;BR /&gt;remsh DESTHOST "ls -l /etc/hosts"&lt;BR /&gt;&lt;BR /&gt;Your second question can be done with tar and rcp or scp.&lt;BR /&gt;cd DIRECTORY&lt;BR /&gt;tar cvf /tmp/tarball .&lt;BR /&gt;scp (or rcp) /tmp/tarball DESTINATION:DIRECTORY&lt;BR /&gt;ssh (or remsh) DESTINATION "tar xvf DIRECTORY/tarball"&lt;BR /&gt;&lt;BR /&gt;Cron is easy to use.  Do "man crontab".  It'll tell you all you need.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 27 Dec 2004 11:49:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/3450625#M208748</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2004-12-27T11:49:10Z</dc:date>
    </item>
  </channel>
</rss>

