HCI commando with script

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf HCI commando with script

  • Creator
    Topic
  • #51941
    ronald kalmeijer
    Participant

      I want to use hci commandos with a script. First I want to set the site and then I want to stop a process and after that run a process.

      Setsite <>

      hcienginestop -p

      pause

      hcienginerun -p

      How must I use these commandos in the script

      finally I want to use the script in a cronjob

    Viewing 8 reply threads
    • Author
      Replies
      • #72415
        Robert Kersemakers
        Participant

          Hi Ronald,

          The commands you mention are correct and this kind of script will work when executed under the ‘hci’ user. However cron doesn’t run under ‘hci’ normally, but under administrator. So you will miss some variables.

          What we normally do is do a ‘su – hci’ when running a cron job for Cloverleaf. This way all the required variables are set. Example:

          Code:

          0 4 * * * su hci -c

          You can also set the required variables yourself. Like this: https://usspvlclovertch2.infor.com/viewtopic.php?t=4458&highlight=cron

          Search the forum for ‘cron’ or ‘setsite’ to see more examples.

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        • #72416
          James Cobane
          Participant

            If you set up the hci user’s crontab, then you should be able to execute the commands via cron as the hci user.  Simply invoke the crontab editor (i.e. crontab -e ) while logged in as the ‘hci’ user and add the necessary schedule/scripts.  We have numerous scripts that run via cron for the ‘hci’ user.

            Jim Cobane

            Henry Ford Health

          • #72417
            ronald kalmeijer
            Participant

              Thxs. I can run the script.

              But if I run it with a cron job I got the following message

              standard in must be a tty

            • #72418
              James Cobane
              Participant

                What does your cron entry look like?  From the error, it sounds like there is some erroneous re-direction occurring.

                Jim Cobane

                Henry Ford Health

              • #72419
                Robert Milfajt
                Participant

                  I see from Bob’s example that he said:

                  Code:

                  0 4 * * * su hci -c

                  But if you actually put in the characters in your cron entry, you will most certainly get the error you received!  You should put in your command script (minus the ) characters to get it to work properly, e.g.:

                  Code:

                  0 4 * * * su hci -c /qvdx/qdx5.5/integrator/site/bin/script_name

                  Hope this helps,

                  Robert Milfajt
                  Northwestern Medicine
                  Chicago, IL

                • #72420

                  “” is a programmer’s convention that means “substitute your text here”. You’ll see it a lot in usage statements with arguments such as “scriptName -a ” or something like that.

                  -- Max Drown (Infor)

                • #72421
                  ronald kalmeijer
                  Participant

                    I use the following commandos under the name proces_test:

                    Code:

                    #! /usr/bin/ksh
                    setsite maasstad
                    hcienginestop -p pacs2
                    sleep 10
                    hcienginerun -p pacs2


                    I can run the script (./proces_test)

                    If I use the commando crontab -e with the line it doesn’t run:

                    55 * * * * su hci -c /quovadx/qdx5.6/integrator/maasstad/proces_test

                    The logging gives me the following output:

                    Code:

                    From hci@cl-test01.mcrz.intra  Mon Aug 23 08:55:01 2010
                    Return-Path:
                    Received: from cl-test01.mcrz.intra (localhost.localdomain [127.0.0.1])
                    by cl-test01.mcrz.intra (8.13.8/8.13.8) with ESMTP id o7N6t1dX028977
                    for ; Mon, 23 Aug 2010 08:55:01 +0200
                    Received: (from hci@localhost)
                    by cl-test01.mcrz.intra (8.13.8/8.13.8/Submit) id o7N6t1tg028976;
                    Mon, 23 Aug 2010 08:55:01 +0200
                    Date: Mon, 23 Aug 2010 08:55:01 +0200
                    Message-Id:
                    From: root@cl-test01.mcrz.intra (Cron Daemon)
                    To: hci@cl-test01.mcrz.intra
                    Subject: Cron su hci -c /quovadx/qdx5.6/integrator/maasstad/proces_test
                    Content-Type: text/plain; charset=UTF-8
                    Auto-Submitted: auto-generated
                    X-Cron-Env:
                    X-Cron-Env:
                    X-Cron-Env:
                    X-Cron-Env:
                    X-Cron-Env:

                    standard in must be a tty

                  • #72422
                    Robert Kersemakers
                    Participant

                      Ah. I think I gave a wrong advice. It should be ‘su – hci -c …’. This is a line from our current crontab, which is run under ‘root’:

                      Code:

                      00 12 * * 6 su – hci -c “/cldata/scripts/weekly_housekeeping_cloverleaf” > /dev/null 2>&1


                      Sorry for the misunderstanding. Does it work like this?

                      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                    • #72423
                      ronald kalmeijer
                      Participant

                        I solved the problem.

                        Instead of ksh I use now bash and the cronjob looks like this:

                        Code:

                        55 * * * * bash –login /quovadx/qdx5.6/integrator/maasstad/proces_test


                        The script proces_test begins with

                        #! /bin/bash

                        instead of

                        #! /usr/bin/ksh

                        Thanks for the support.

                    Viewing 8 reply threads
                    • The forum ‘Cloverleaf’ is closed to new topics and replies.