<?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 launch an user script from root crontab in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952515#M413897</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I need to launch an script from oracle user in order to check database so I need to schedule execution on crontab.&lt;BR /&gt;&lt;BR /&gt;Problem is I want scheduled scripts are launched from root crontab, so how can I launch an script from oracle user but scheduled from root crontab?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles</description>
    <pubDate>Mon, 16 Jan 2006 03:10:38 GMT</pubDate>
    <dc:creator>Carles Viaplana</dc:creator>
    <dc:date>2006-01-16T03:10:38Z</dc:date>
    <item>
      <title>launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952515#M413897</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I need to launch an script from oracle user in order to check database so I need to schedule execution on crontab.&lt;BR /&gt;&lt;BR /&gt;Problem is I want scheduled scripts are launched from root crontab, so how can I launch an script from oracle user but scheduled from root crontab?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles</description>
      <pubDate>Mon, 16 Jan 2006 03:10:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952515#M413897</guid>
      <dc:creator>Carles Viaplana</dc:creator>
      <dc:date>2006-01-16T03:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952516#M413898</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;if i understand u correctly, u may use the su command in the cron:&lt;BR /&gt;&lt;BR /&gt;# su - oracle -c &lt;NAME of="" script=""&gt;&lt;/NAME&gt;&lt;BR /&gt;regards.</description>
      <pubDate>Mon, 16 Jan 2006 03:20:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952516#M413898</guid>
      <dc:creator>Joseph Loo</dc:creator>
      <dc:date>2006-01-16T03:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952517#M413899</link>
      <description>Hi Carles, &lt;BR /&gt;&lt;BR /&gt;You can use "su" to switch to Oracle and execute script. &lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh &lt;BR /&gt;/usr/bin/su - oracle &lt;BR /&gt;&lt;BR /&gt;---Script---&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 16 Jan 2006 03:23:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952517#M413899</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-01-16T03:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952518#M413900</link>
      <description>Shalom Carles,&lt;BR /&gt;&lt;BR /&gt;If the script requires user environment, the /usr/bin/su - oracle -c "command"&lt;BR /&gt;&lt;BR /&gt;methodology is required.&lt;BR /&gt;&lt;BR /&gt;If the user environment is not required, root can run any script it wants.&lt;BR /&gt;&lt;BR /&gt;The reason I point out /usr/bin/su is that by default, cron has no envirnoment, no path, to TERM, no nothing. Therefore one must be very specific when giving commands.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 16 Jan 2006 03:37:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952518#M413900</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-01-16T03:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952519#M413901</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;As mentioned earlier create a script with permissions to only root.&lt;BR /&gt;&lt;BR /&gt;Inside that script define the function&lt;BR /&gt;&lt;BR /&gt;#su - oracle -l /path_to_script/script_name&lt;BR /&gt;&lt;BR /&gt;This shall be able to do the needful.&lt;BR /&gt;&lt;BR /&gt;Also redirect the error and standard ouput to some file like this&lt;BR /&gt;&lt;BR /&gt;#su - oracle -l /path_to_script/script_name 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt;filename&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender</description>
      <pubDate>Mon, 16 Jan 2006 03:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952519#M413901</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2006-01-16T03:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952520#M413902</link>
      <description>Hi Charles,&lt;BR /&gt;If you run the script with su - oracle -c "script-name" from root crontab, be sure, that for files you may use within in the script you should use absolute pathnames or set the PATH variable in the script. As Steven mentioned in the mail before there are no environment variables.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Eberhard</description>
      <pubDate>Mon, 16 Jan 2006 03:49:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952520#M413902</guid>
      <dc:creator>Eberhard Maehr</dc:creator>
      <dc:date>2006-01-16T03:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952521#M413903</link>
      <description>we do everything via cron,&lt;BR /&gt;monitoring, backups etc..&lt;BR /&gt;&lt;BR /&gt;30 6,12,18 * * 1-6 su - orasys -c "/picnew/backup/bin/backup_ora_autosys.sh" &amp;gt; /tmp/applautosys.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Make sure you declare variables&lt;BR /&gt;explicitly: see example script&lt;BR /&gt;&lt;BR /&gt;# does an export of an apps in Oracle : Autosys&lt;BR /&gt;#&lt;BR /&gt;set -x&lt;BR /&gt;print "Running $0 on $(date)"&lt;BR /&gt;NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1&lt;BR /&gt;export NLS_LANG&lt;BR /&gt;DATE=$(date "+%d%m%y")&lt;BR /&gt;export DATE&lt;BR /&gt;ORACLE_SID=autoP1&lt;BR /&gt;export ORACLE_SID&lt;BR /&gt;ORACLE_HOME=/usr/oracle/product/8.1.7.64&lt;BR /&gt;export ORACLE_HOME&lt;BR /&gt;APPS=autosys&lt;BR /&gt;export APPS&lt;BR /&gt;USER=autosys&lt;BR /&gt;export USER&lt;BR /&gt;EXPORTDIR=/usr/oracle/admin/autoP1/exports/&lt;BR /&gt;cd $EXPORTDIR&lt;BR /&gt;cp -p $EXPORTDIR/autosys$DATE.gz $EXPORTDIR/autosys$DATE.gz-1&lt;BR /&gt;if ( exp system/iatsuaiaop file=$EXPORTDIR/$APPS$DATE owner=$USER compress=n consistent=y direct=true log=&lt;BR /&gt;$EXPORTDIR/$APPS$DATE.log )&lt;BR /&gt; then&lt;BR /&gt;  echo "$ORACLE_SID $APPS Export Succesfull"&lt;BR /&gt; else&lt;BR /&gt;  echo "$ORACLE_SID $APPS Export Unsuccesfull" | mailx -s "$ORACLE_SID $APPS Production export NOK" me.&lt;BR /&gt;@me.com&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;/usr/contrib/bin/gzip -f $EXPORTDIR/$APPS$DATE.dmp&lt;BR /&gt;pwd&lt;BR /&gt;ll&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;This is a working example.&lt;BR /&gt;Good luck&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jan 2006 03:54:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952521#M413903</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2006-01-16T03:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952522#M413904</link>
      <description>we do everything via cron,&lt;BR /&gt;monitoring, backups etc..&lt;BR /&gt;&lt;BR /&gt;30 6,12,18 * * 1-6 su - orasys -c "/picnew/backup/bin/backup_ora_autosys.sh" &amp;gt; /tmp/applautosys.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Make sure you declare variables&lt;BR /&gt;explicitly: see example script&lt;BR /&gt;&lt;BR /&gt;# does an export of an apps in Oracle : Autosys&lt;BR /&gt;#&lt;BR /&gt;set -x&lt;BR /&gt;print "Running $0 on $(date)"&lt;BR /&gt;NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1&lt;BR /&gt;export NLS_LANG&lt;BR /&gt;DATE=$(date "+%d%m%y")&lt;BR /&gt;export DATE&lt;BR /&gt;ORACLE_SID=autoP1&lt;BR /&gt;export ORACLE_SID&lt;BR /&gt;ORACLE_HOME=/usr/oracle/product/8.1.7.64&lt;BR /&gt;export ORACLE_HOME&lt;BR /&gt;APPS=autosys&lt;BR /&gt;export APPS&lt;BR /&gt;USER=autosys&lt;BR /&gt;export USER&lt;BR /&gt;EXPORTDIR=/usr/oracle/admin/autoP1/exports/&lt;BR /&gt;cd $EXPORTDIR&lt;BR /&gt;cp -p $EXPORTDIR/autosys$DATE.gz $EXPORTDIR/autosys$DATE.gz-1&lt;BR /&gt;if ( exp system/passwd file=$EXPORTDIR/$APPS$DATE owner=$USER compress=n consistent=y direct=true log=&lt;BR /&gt;$EXPORTDIR/$APPS$DATE.log )&lt;BR /&gt; then&lt;BR /&gt;  echo "$ORACLE_SID $APPS Export Succesfull"&lt;BR /&gt; else&lt;BR /&gt;  echo "$ORACLE_SID $APPS Export Unsuccesfull" | mailx -s "$ORACLE_SID $APPS Production export NOK" me.&lt;BR /&gt;@me.com&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;/usr/contrib/bin/gzip -f $EXPORTDIR/$APPS$DATE.dmp&lt;BR /&gt;pwd&lt;BR /&gt;ll&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;This is a working example.&lt;BR /&gt;Good luck&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jan 2006 03:55:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952522#M413904</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2006-01-16T03:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952523#M413905</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your replies.&lt;BR /&gt;&lt;BR /&gt;I just added "su - oracle -c" to command I got in root crontab and it works fine.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Carles&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jan 2006 05:57:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952523#M413905</guid>
      <dc:creator>Carles Viaplana</dc:creator>
      <dc:date>2006-01-16T05:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: launch an user script from root crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952524#M413906</link>
      <description>Hi,&lt;BR /&gt;Thank you so much for the script. I have been trying to start Alfresco using cron.&lt;BR /&gt;Since i was not logging the errors, i didn't realize the problem until "Permission Denied" on the log method shown here.&lt;BR /&gt;&lt;BR /&gt;Also setting the variables for the program in the scripts made it run as per schedule.&lt;BR /&gt;&lt;BR /&gt;My hearty thanks.&lt;BR /&gt;&lt;BR /&gt;So my script looks like this now:&lt;BR /&gt;&lt;BR /&gt;for cron:&lt;BR /&gt;&lt;BR /&gt;SHELL=/bin/bash&lt;BR /&gt;37 * * * * su - root -c "/opt/alf_script.sh" &amp;gt; /opt/oracle_script.log 2&amp;gt;&amp;amp;1 &lt;BR /&gt;&lt;BR /&gt;and the alf_script.sh is:&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;export CATALINA_HOME=/opt/alfresco/tomcat&lt;BR /&gt;export CATALINA_BASE=/opt/alfresco/tomcat&lt;BR /&gt;export JAVA_HOME=/usr/java/jdk1.6.0_04&lt;BR /&gt;export JRE_HOME=/usr/java/jdk1.6.0_04/jre&lt;BR /&gt;hostname localhost&lt;BR /&gt;PATH=$PATH:/opt/alfresco/bin&lt;BR /&gt;/opt/alfresco/tomcat/bin/startup.sh&lt;BR /&gt;&lt;BR /&gt;and the log now says:&lt;BR /&gt;&lt;BR /&gt;++ export CATALINA_HOME=/opt/alfresco/tomcat&lt;BR /&gt;++ CATALINA_HOME=/opt/alfresco/tomcat&lt;BR /&gt;++ export CATALINA_BASE=/opt/alfresco/tomcat&lt;BR /&gt;++ CATALINA_BASE=/opt/alfresco/tomcat&lt;BR /&gt;++ export JAVA_HOME=/usr/java/jdk1.6.0_04&lt;BR /&gt;++ JAVA_HOME=/usr/java/jdk1.6.0_04&lt;BR /&gt;++ export JRE_HOME=/usr/java/jdk1.6.0_04/jre&lt;BR /&gt;++ JRE_HOME=/usr/java/jdk1.6.0_04/jre&lt;BR /&gt;++ hostname localhost&lt;BR /&gt;++ PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/alfresco/bin:/root/bin:/opt/alfresco/bin&lt;BR /&gt;++ /opt/alfresco/tomcat/bin/startup.sh&lt;BR /&gt;&lt;BR /&gt;after running a chmod 777 on the alf_script.sh&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards,&lt;BR /&gt;Vibhu.</description>
      <pubDate>Thu, 21 Aug 2008 09:17:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/launch-an-user-script-from-root-crontab/m-p/4952524#M413906</guid>
      <dc:creator>Vibhu Tewary</dc:creator>
      <dc:date>2008-08-21T09:17:46Z</dc:date>
    </item>
  </channel>
</rss>

