<?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: install cron issue in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063265#M54274</link>
    <description>ssh -n user@host1 "echo */10 * * * * /script.sh '&amp;gt;' /logs/output.\$HOSTNAME '&amp;gt;' /tmp/cron-list"&lt;BR /&gt;&lt;BR /&gt;HOSTNAME: Undefined variable.</description>
    <pubDate>Fri, 10 May 2013 06:01:44 GMT</pubDate>
    <dc:creator>allanm77</dc:creator>
    <dc:date>2013-05-10T06:01:44Z</dc:date>
    <item>
      <title>install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6062873#M54269</link>
      <description>&lt;PRE&gt;ssh -n host1 "crontab &amp;lt;&amp;lt; */10 * * * * /usr/local/script.sh &amp;gt; /logs/output.${HOSTNAME}"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have around 100 hosts and need to populate this cron entry on them but the variable $HOSTNAME is expanding to the name of the admin box I am trying to deploy from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I fix this. Please advise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Allan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. This thread has been moevd&amp;nbsp;from HP-UX &amp;gt; Languages and Scripting to Linux &amp;gt; sysadmin - Hp Forums Moderator&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2013 09:29:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6062873#M54269</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-13T09:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6062899#M54270</link>
      <description>&lt;P&gt;I would use $(hostname) rather that ${HOSTNAME}. &amp;nbsp;$(hostname) will run the hostname command on the serve that the script runs on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if you are deploying this to HP-UX servers, the */10 syntax will not work. &amp;nbsp;That is Linux ONLY syntax. &amp;nbsp;If you want the script to run every 10 minutes in HP-UX you need to specify 0,10,20,30,40,50 for the minutes.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2013 02:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6062899#M54270</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2013-05-10T02:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063083#M54271</link>
      <description>&lt;P&gt;This is linux I am afraid, the $(hostname) doesnt work on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Allan.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2013 03:57:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063083#M54271</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-10T03:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063165#M54272</link>
      <description>even with single quotes I am getting -&lt;BR /&gt;&lt;BR /&gt;ssh -n host1 echo '*/10 * * * * /usr/local/script.sh &amp;gt; /logs/output.${HOSTNAME}' &amp;gt;&amp;gt; /tmp/cron-list&lt;BR /&gt;&lt;BR /&gt;HOSTNAME: Undefined variable.</description>
      <pubDate>Fri, 10 May 2013 04:53:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063165#M54272</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-10T04:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063217#M54273</link>
      <description>Its also not liking the redirection, I am really dead in water, please help!</description>
      <pubDate>Fri, 10 May 2013 05:38:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063217#M54273</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-10T05:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063265#M54274</link>
      <description>ssh -n user@host1 "echo */10 * * * * /script.sh '&amp;gt;' /logs/output.\$HOSTNAME '&amp;gt;' /tmp/cron-list"&lt;BR /&gt;&lt;BR /&gt;HOSTNAME: Undefined variable.</description>
      <pubDate>Fri, 10 May 2013 06:01:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063265#M54274</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-10T06:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: ssh and crontab problem, variable expansion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063389#M54275</link>
      <description>&lt;P&gt;&amp;gt;the variable $HOSTNAME is expanding to the name of the admin box I am trying to deploy from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you need to use single quotes:&lt;/P&gt;&lt;P&gt;ssh -n host1 'crontab &amp;lt;&amp;lt; */10 * * * * /usr/local/script.sh &amp;gt; /logs/output.${HOSTNAME}'&lt;/P&gt;&lt;P&gt;Also, I assume this &amp;lt;&amp;lt; syntax is some bashism?&amp;nbsp; I guess it isn't.&amp;nbsp; You would need to set up a here doc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If single quotes doesn't work, it's because $HOSTNAME isn't defined by default.&lt;/P&gt;&lt;P&gt;So you could do this:&lt;/P&gt;&lt;P&gt;ssh -n user@host1 "echo '*/10 * * * * /script.sh &amp;gt; /logs/output.host1' | crontab"&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2013 01:33:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063389#M54275</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2013-05-11T01:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: install cron issue, variable expansion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063909#M54276</link>
      <description>&lt;P&gt;Thanks Dennis that worked though I figured out the solution before I saw your reply.&lt;BR /&gt;&lt;BR /&gt;Another issue I wanted to solve is that&amp;nbsp; I dont have sshkeyless setup to the hosts and dont have expect installed on the admin box, how do I remote ssh without(or automatically) feeding in the password each time for all 100 hosts?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2013 00:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063909#M54276</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2013-05-11T00:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: ssh and crontab problem, variable expansion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063951#M54277</link>
      <description>&lt;P&gt;&amp;gt;I don't have sshkeyless setup to the hosts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Did you mean password less?)&lt;/P&gt;&lt;P&gt;I would spend time setting this up so you don't have to do it again.&lt;/P&gt;&lt;P&gt;(Unless you have some management or security reason for not doing it.)-:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;don't have expect installed on the admin box, how do I remote ssh without (or automatically) feeding in the password each time for all 100 hosts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well that's what ssh passwordless is for.&lt;/P&gt;&lt;P&gt;Without expect, I'm not sure there is any other way.&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2013 01:33:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/install-cron-issue/m-p/6063951#M54277</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2013-05-11T01:33:35Z</dc:date>
    </item>
  </channel>
</rss>

