Layer7 API Management

Expand all | Collapse all

How to add a new cron job in gateway v9.4?

Jump to Best Answer
  • 1.  How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 05:37 AM

    Hi,

    I'd downloaded audit_purge.sh from the community and I'd like to set a cron job for executing this script every day.

    I tried to run command "crontab -e" but no this command.

     

    How do I do to make this script run every day?

     

    Thanks.



  • 2.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 05:46 AM

    Bravomao

    the crontab -e  should display a new file in vi (if you haven't setup a cronjob already) 

    In here you will need to add the audit_puge entry as mentioned in  https://comm.support.ca.com/kb/configuring-and-installing-the-audit-record-maintenance-script/kb000042480

    You will then need to save that file using :wq

     

    What exactly on this command is not working for you?



  • 3.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 05:59 AM

    Hi Conny,

    I uploaded the script(audit_purge.sh) to the gateway and ran it manually with no problem.

    When I try to set it as a cron job, I enter "crontab -e" in gateway's terminal and the terminal shows me this message.

     

    -bash: crontab: command not found 

     

    That's why I'd like to know how to set it as a cron job.

     

    Thanks.



  • 4.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 06:05 AM

    Thanks for the response.

     

    What form factor of the gateway are you using? 

    In the virtual and hardware appliance of the gateway the crontab should be available.



  • 5.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 06:07 AM

    Hi Conny,

    I deployed the gateway from an ova file.

    The version of the gateway is 9.4 and the OS type is CentOS.

     

    I saw there're several cron related file and directory under /etc folder.

    /etc/cron.d

    /etc/cron.daily

    ....etc



  • 6.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 07:17 AM

    How did you get to the command prompt and what user are you using?

    It may be something related to user rights and/or profile if you are not using the default user.



  • 7.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 07:43 AM

    Hi Michiel,

    First I use ssgconfig through ssh.

    Then I use option 3 to login to privileged console.

    I use whoami command to check my account, it’s root.

     

    Thanks.



  • 8.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-10-2019 11:00 PM

    Hi, 

    I tried to use rpm -qa to search cron related package but nothing be found.

    If I need to install cron bymyself, what rpm package should I install?

    crontabs only?

     

    Thanks



  • 9.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-11-2019 04:45 AM

    Hi Gary,

     

    based on what is installed on my test gateway this should be:

    cronie-1.4.4-16.el6_8.2.x86_64
    cronie-anacron-1.4.4-16.el6_8.2.x86_64
    crontabs-1.10-33.el6.noarch



  • 10.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-11-2019 04:51 AM

    Hi Conny,

    Unfortunately, when I used rpm -qa cron command, it returns me nothing.

    How can I install the package by myself?

    I tried to use yum install -y crontabs or cronie but failed.



  • 11.  Re: How to add a new cron job in gateway v9.4?

    Posted 04-11-2019 08:14 PM

    Dear Gary,

    you may try the command,

    rpm -aq |grep cron

     

    the appliance gateway has cron installed by default, you should see the same as posco01 shows.

    and the appliance gateway doesn't have yum installed.

     

    Regards,

    Mark



  • 12.  Re: How to add a new cron job in gateway v9.4?
    Best Answer

    Posted 04-11-2019 11:22 PM

    Hi,

    I finally found the root cause and it's my fault.

    Cron is really not there because my engineer used to change the version of MySQL from embedded to community.

    He uses yum to uninstall MySQL so several dependency packages have been removed

     

    If somebody encounters the same situation, here's the workaround.

    - download these packages.

      sendmail-8.14.4-9.el6_8.1.x86_64

      cronie-1.4.4-16.el6_8.2.x86_64
      cronie-anacron-1.4.4-16.el6_8.2.x86_64
      crontabs-1.10-33.el6.noarch

    - install sendmail first.

    - install cronie-1.4.4-16.el6_8.2.x86_64 with --nodeps  (It shows error if --nodeps is not there.)

    - install crontabs-1.10-33.el6.noarch

    - install cronie-anacron-1.4.4-16.el6_8.2.x86_64

    -Done

     

    Thanks all of you