<?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 setting cron by script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886337#M704545</link>
    <description>Hi friends,&lt;BR /&gt;need ur help to setup cron job on a remote server by script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur</description>
    <pubDate>Thu, 17 Feb 2005 00:21:15 GMT</pubDate>
    <dc:creator>ankurp</dc:creator>
    <dc:date>2005-02-17T00:21:15Z</dc:date>
    <item>
      <title>setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886337#M704545</link>
      <description>Hi friends,&lt;BR /&gt;need ur help to setup cron job on a remote server by script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Thu, 17 Feb 2005 00:21:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886337#M704545</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-02-17T00:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886338#M704546</link>
      <description>Hi Ankur,&lt;BR /&gt;&lt;BR /&gt;You need to create a &lt;USER&gt;.tmp file in the /usr/spool/cron/crontabs directory of that server with all the commands/scripts you want to execute, time, days. Something like this:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;50 03 16 * * $HOME/scripts/a.sh&lt;BR /&gt;55 03 1,10,20 * * $HOME/scripts/b.sh&lt;BR /&gt;00 04 1,16 * * $HOME/scripts/b.sh&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;And activate the cron scheduler:&lt;BR /&gt;&lt;BR /&gt;#crontab /usr/spool/cron/crontabs/&lt;USER&gt;.tmp&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Eric Antunes&lt;/USER&gt;&lt;/USER&gt;</description>
      <pubDate>Thu, 17 Feb 2005 04:12:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886338#M704546</guid>
      <dc:creator>Eric Antunes</dc:creator>
      <dc:date>2005-02-17T04:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886339#M704547</link>
      <description>Hi Ankur&lt;BR /&gt;&lt;BR /&gt;Can you expand your question.  I think you mean you want to execute a script on one server (server A) which connects to another server (server B) and creates a crontab on that server (B)?&lt;BR /&gt;&lt;BR /&gt;If so, remsh may be your best option to enable you to remotely submit the crontab on server B.  Be aware though that this isn't totally secure.  As an example (cronjob at 8am everyday):&lt;BR /&gt;&lt;BR /&gt;echo "00 08 * * * /myjob" &amp;gt;/tmp/newcrontab&lt;BR /&gt;rcp /tmp/newcrontab SERVERB:/tmp/newcrontab&lt;BR /&gt;remsh SERVERB "/usr/bin/crontab /tmp/newcrontab"&lt;BR /&gt;&lt;BR /&gt;Remember, /myjob must be on server B already for cron to execute it!&lt;BR /&gt;&lt;BR /&gt;Give us a little more information if this is not what you require.&lt;BR /&gt;&lt;BR /&gt;All the best - Keith</description>
      <pubDate>Thu, 17 Feb 2005 04:20:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886339#M704547</guid>
      <dc:creator>Keith Bryson</dc:creator>
      <dc:date>2005-02-17T04:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886340#M704548</link>
      <description>If the user on the remote machine already has a crontab file, it would be safer to append the required line to the user's crontab file:&lt;BR /&gt;&lt;BR /&gt;remsh hostb "echo '00 08 * * * /myjob' &amp;gt;&amp;gt; /var/spool/cron/crontabs/&lt;USER&gt;"&lt;BR /&gt;remsh hostb /sbin/init.d/cron stop&lt;BR /&gt;remsh hostb /sbin/init.d/cron start&lt;BR /&gt;&lt;/USER&gt;</description>
      <pubDate>Thu, 17 Feb 2005 12:06:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886340#M704548</guid>
      <dc:creator>Gordon  Morrison_1</dc:creator>
      <dc:date>2005-02-17T12:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886341#M704549</link>
      <description>You can create a file on the machine remotely and then cat filename &amp;gt;&amp;gt; &lt;CRON file="" for="" user=""&gt;&lt;BR /&gt;&lt;BR /&gt;Its usually more trouble to write such a script than it is to log on the machine and simply edit the cron file or run crontab -e.&lt;BR /&gt;&lt;BR /&gt;I endorse the latter approach.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;/CRON&gt;</description>
      <pubDate>Thu, 17 Feb 2005 12:08:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886341#M704549</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-02-17T12:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886342#M704550</link>
      <description>Simply updating a user's cron file on the remote machine is not sufficient. The cron daemon won't know anything has changed. It is also necessary that a SIGHUP (kill -1) be sent to the cron daemon. Use the crontan command. It updates the file AND sends the SIGHUP.</description>
      <pubDate>Thu, 17 Feb 2005 12:14:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886342#M704550</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-02-17T12:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886343#M704551</link>
      <description>That was overwhelming responce thanks for that.&lt;BR /&gt;I wrote a script, but it doesnt get executed on all HP ux servers (worked fine on some).&lt;BR /&gt;i dont know why ? .&lt;BR /&gt;Also i dont want to rsh / rmsh commands, also they ask for passwords.&lt;BR /&gt;&lt;BR /&gt;SCRIPT : &lt;BR /&gt;for i in `cat servers`&lt;BR /&gt;do OS=`ssh $i uname -s`&lt;BR /&gt;echo $OS&lt;BR /&gt;if [ $OS = HP-UX ]&lt;BR /&gt;then&lt;BR /&gt;echo "Creating /var/adm/sa $i server"&lt;BR /&gt;ssh $i mkdir /var/adm/sa&lt;BR /&gt;echo "Setting up cron for $i  server"&lt;BR /&gt;&lt;BR /&gt;ssh $i cp -p /var/spool/cron/crontabs/root  /var/spool/cron/crontabs/root.1&lt;BR /&gt;ssh $i echo "0 * * * * /usr/lib/sa/sa1 600 6" &amp;gt;&amp;gt; /var/spool/cron/crontabs/root.1&lt;BR /&gt;ssh $i crontab /var/spool/cron/crontabs/root.1&lt;BR /&gt;echo " Present :  Crontab -l "&lt;BR /&gt;ssh $i crontab -l&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;elif [ $OS = Linux ]&lt;BR /&gt;then&lt;BR /&gt;echo "linux Box :  $i server"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Pls. help&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Thu, 17 Feb 2005 23:19:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886343#M704551</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-02-17T23:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886344#M704552</link>
      <description>Ankur&lt;BR /&gt;&lt;BR /&gt;If you're using ssh to remotely connect and execute commands, make sure you have distributed your public key from the central server to the remote server(s) and added the necessary syntax to the same users $HOME/.ssh/authorization file.  If you run the script manually, does it pause when trying to connect to some systems?  I would also recommend creating the temporary (new) crontab in /tmp rather than the cron spool directory and submitting it to cron from there. &lt;BR /&gt;&lt;BR /&gt;Keith</description>
      <pubDate>Fri, 18 Feb 2005 02:48:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886344#M704552</guid>
      <dc:creator>Keith Bryson</dc:creator>
      <dc:date>2005-02-18T02:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886345#M704553</link>
      <description>hi ,&lt;BR /&gt;&lt;BR /&gt;I have distributed the keys and can execute the command w/o password.&lt;BR /&gt;This thing doesnt work.&lt;BR /&gt;&lt;BR /&gt;ssh $i echo "0 * * * * /usr/lib/sa/sa1 600 6" &amp;gt;&amp;gt; /var/spool/cron/crontabs/root.1&lt;BR /&gt;&lt;BR /&gt;Why do i need to create a tmp directory.&lt;BR /&gt;&lt;BR /&gt;Waitn for ur help.&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Fri, 18 Feb 2005 03:23:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886345#M704553</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-02-18T03:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886346#M704554</link>
      <description>It's due to the double quotes after the echo command.  SSH expects the remote command to be in the double quotes!!!&lt;BR /&gt;&lt;BR /&gt;Try this instead:&lt;BR /&gt;&lt;BR /&gt;ssh2 -l username server "echo 'blabla bla bla' &amp;gt;/tmp/me"&lt;BR /&gt;(obviously modified to your command) - the quote for the exho is the one under the @ sign!!&lt;BR /&gt;&lt;BR /&gt;Keith</description>
      <pubDate>Fri, 18 Feb 2005 03:30:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886346#M704554</guid>
      <dc:creator>Keith Bryson</dc:creator>
      <dc:date>2005-02-18T03:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886347#M704555</link>
      <description>Basically, your script would then read:&lt;BR /&gt;&lt;BR /&gt;ssh $i "cp -p /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.1"&lt;BR /&gt;ssh $i "echo '0 * * * * /usr/lib/sa/sa1 600 6' &amp;gt;&amp;gt; /var/spool/cron/crontabs/root.1"&lt;BR /&gt;ssh $i "crontab /var/spool/cron/crontabs/root.1"&lt;BR /&gt;&lt;BR /&gt;All the best - Keith&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Feb 2005 03:40:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886347#M704555</guid>
      <dc:creator>Keith Bryson</dc:creator>
      <dc:date>2005-02-18T03:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: setting cron by script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886348#M704556</link>
      <description>VEry Thanks to all my dear friends.&lt;BR /&gt;I hope to be like u ;-}&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Fri, 18 Feb 2005 06:13:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-cron-by-script/m-p/4886348#M704556</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-02-18T06:13:51Z</dc:date>
    </item>
  </channel>
</rss>

