AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Fri June 10, 2022 07:15 PM
    Anyone seen a method to have individual cron jobs in single files on AIX?

    I can always fall back on a daily script which runs everything from one location.

    ------------------------------
    ========================
    Russell Adams
    https://adamssystems.nl/
    ========================
    ------------------------------


  • 2.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Sat June 11, 2022 05:07 AM
    Individual files?
    Can you elaborate ?





  • 3.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Sat June 11, 2022 05:19 AM
    Tom,

    Many Linux distros (and FreeBSD!) place crontabs from packages into
    directories like /etc/cron.d/daily.

    https://unix.stackexchange.com/questions/458713/how-are-files-under-etc-cron-d-used

    If you had a backup software package, it might create a file
    /etc/cron.d/daily/backups.cron instead of trying to reliably add or
    remove lines of text to root's crontab.

    It's really a packaging technique. In the world of configuration
    management it's *really* hard to reliably patch a text file with
    dynamic contents like crontab, versus dropping in a unique file.

    You can do something similar with a root crontab entry like:

    0 0 * * * /path/to/my/daily.sh

    Where daily.sh just does:

    for X in /etc/cron.daily/* ; do $X ; done

    That's really hacky, but same concept.

    On Sat, Jun 11, 2022 at 09:07:30AM +0000, Tom McGivern via IBM Community wrote:
    > Individual files?Can you elaborate ?
    >
    > -------------------------------------------
    > Original Message:
    > Sent: 6/10/2022 7:15:00 PM
    > From: Russell Adams
    > Subject: Something like cron.daily or /etc/cron.d/ for AIX?
    >
    > Anyone seen a method to have individual cron jobs in single files on AIX?
    >
    > I can always fall back on a daily script which runs everything from one location.
    >
    > ------------------------------
    > ========================
    > Russell Adams
    > https://adamssystems.nl/
    > ========================
    > ------------------------------
    >
    >
    > Reply to Sender : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258458&SenderKey=4f5c88a2-c315-465e-9098-ff14f4c25de8
    >
    > Reply to Discussion : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258458
    >
    >
    >
    > You are subscribed to "AIX" as Russell.Adams@AdamsSystems.nl. To change your subscriptions, go to http://community.ibm.com/community/user/preferences?section=Subscriptions. To unsubscribe from this community discussion, go to http://community.ibm.com/HigherLogic/eGroups/Unsubscribe.aspx?UserKey=c23dfccc-9910-40ae-beeb-fdcbced5bf1f&sKey=KeyRemoved&GroupKey=7b554d78-d4dc-417a-b4dc-017e309e5c91.


    ------------------------------------------------------------------
    Russell Adams Russell.Adams@AdamsSystems.nl
    Principal Consultant Adams Systems Consultancy
    https://adamssystems.nl/




  • 4.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Mon June 13, 2022 03:45 AM
    Hi,

    IMHO the short answer is no, not without replacing or at least partially rewriting the cron daemon that is used in AIX.
    IIRC the cron daemon used by AIX orginates from System V, because its history does not have any idea of these "newfagled" thingamabogs like "@daily", "@weekly", "@monthly", "@yearly" or "@reboot" crontab shortcuts etc introduced in newer non SystemV cron daemons.

    AFAIK you and others in the community can ask IBM to replace cron daemon used in AIX, using "request for proposals" RFP process.

    FWIW your "hacky" solution is perfectly fine, I'd add "test -x" and "echo $?" into the loop.

    Br, Esa

    ------------------------------
    Esa Kärkkäinen
    ------------------------------



  • 5.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Mon June 13, 2022 04:26 AM
    I'm not advocating for major changes to cron. Simply asking if this
    had been made available where I knew it wasn't there in the past.

    I'll go look at what some of the Linux scripts are doing. Maybe I can
    quickly port that over to AIX while being a little less "hacky". ;]

    On Mon, Jun 13, 2022 at 07:44:52AM +0000, Esa K?rkk?inen via IBM Community wrote:
    > Hi,
    >
    > IMHO the short answer is no, not without replacing or at least partially rewriting the cron daemon that is used in AIX.
    > IIRC the cron daemon used by AIX orginates from System V, because its history does not have any idea of these "newfagled" thingamabogs like "@daily", "@weekly", "@monthly", "@yearly" or "@reboot" crontab shortcuts etc introduced in newer non SystemV cron daemons.
    >
    > AFAIK you and others in the community can ask IBM to replace cron daemon used in AIX, using "request for proposals" RFP process.
    >
    > FWIW your "hacky" solution is perfectly fine, I'd add "test -x" and "echo $?" into the loop.
    >
    > Br, Esa
    >
    > ------------------------------
    > Esa K?rkk?inen
    > ------------------------------
    > -------------------------------------------
    > Original Message:
    > Sent: Sat June 11, 2022 05:18 AM
    > From: Russell Adams
    > Subject: Something like cron.daily or /etc/cron.d/ for AIX?
    >
    > Tom,
    >
    > Many Linux distros (and FreeBSD!) place crontabs from packages into
    > directories like /etc/cron.d/daily.
    >
    > https://unix.stackexchange.com/questions/458713/how-are-files-under-etc-cron-d-used <https: unix.stackexchange.com/questions/458713/how-are-files-under-etc-cron-d-used="">
    >
    > If you had a backup software package, it might create a file
    > /etc/cron.d/daily/backups.cron instead of trying to reliably add or
    > remove lines of text to root's crontab.
    >
    > It's really a packaging technique. In the world of configuration
    > management it's *really* hard to reliably patch a text file with
    > dynamic contents like crontab, versus dropping in a unique file.
    >
    > You can do something similar with a root crontab entry like:
    >
    > 0 0 * * * /path/to/my/daily.sh
    >
    > Where daily.sh just does:
    >
    > for X in /etc/cron.daily/* ; do $X ; done
    >
    > That's really hacky, but same concept.
    >
    > On Sat, Jun 11, 2022 at 09:07:30AM +0000, Tom McGivern via IBM Community wrote:
    > > Individual files?Can you elaborate ?
    > >
    > > -------------------------------------------
    > > Original Message:
    > > Sent: 6/10/2022 7:15:00 PM
    > > From: Russell Adams
    > > Subject: Something like cron.daily or /etc/cron.d/ for AIX?
    > >
    > > Anyone seen a method to have individual cron jobs in single files on AIX?
    > >
    > > I can always fall back on a daily script which runs everything from one location.
    > >
    > > ------------------------------
    > > ========================
    > > Russell Adams
    > > https://adamssystems.nl/ <https: adamssystems.nl/="">
    > > ========================
    > > ------------------------------
    > >
    > >
    > > Reply to Sender : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258458&SenderKey=4f5c88a2-c315-465e-9098-ff14f4c25de8 <https: community.ibm.com/community/user/egroups/postreply?groupid="6049&MID=258458&SenderKey=4f5c88a2-c315-465e-9098-ff14f4c25de8">
    > >
    > > Reply to Discussion : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258458 <https: community.ibm.com/community/user/egroups/postreply?groupid="6049&MID=258458">
    > >
    > >
    > >
    > > You are subscribed to "AIX" as Russell.Adams@AdamsSystems.nl <russell.adams@adamssystems.nl>. To change your subscriptions, go to http://community.ibm.com/community/user/preferences?section=Subscriptions. <http: community.ibm.com/community/user/preferences?section="Subscriptions."> To unsubscribe from this community discussion, go to http://community.ibm.com/HigherLogic/eGroups/Unsubscribe.aspx?UserKey=c23dfccc-9910-40ae-beeb-fdcbced5bf1f&sKey=KeyRemoved&GroupKey=7b554d78-d4dc-417a-b4dc-017e309e5c91. <http: community.ibm.com/higherlogic/egroups/unsubscribe.aspx?userkey="c23dfccc-9910-40ae-beeb-fdcbced5bf1f&sKey=KeyRemoved&GroupKey=7b554d78-d4dc-417a-b4dc-017e309e5c91.">
    >
    >
    > ------------------------------------------------------------------
    > Russell Adams Russell.Adams@AdamsSystems.nl <russell.adams@adamssystems.nl>
    > Principal Consultant Adams Systems Consultancy
    > https://adamssystems.nl/ <https: adamssystems.nl/="">
    >
    >
    > Original Message:
    > Sent: 6/11/2022 5:07:00 AM
    > From: Tom McGivern
    > Subject: RE: Something like cron.daily or /etc/cron.d/ for AIX?
    >
    > Individual files?Can you elaborate ?
    >
    >
    > Original Message:
    > Sent: 6/10/2022 7:15:00 PM
    > From: Russell Adams
    > Subject: Something like cron.daily or /etc/cron.d/ for AIX?
    >
    > Anyone seen a method to have individual cron jobs in single files on AIX?
    >
    > I can always fall back on a daily script which runs everything from one location.
    >
    > ------------------------------
    > ========================
    > Russell Adams
    > https://adamssystems.nl/ <https: adamssystems.nl/="">
    > ========================
    > ------------------------------
    >
    >
    > Reply to Sender : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258494&SenderKey=1b9bfa5e-cdcf-46be-a273-1d2a4e10703b
    >
    > Reply to Discussion : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258494
    >
    >
    >
    > You are subscribed to "AIX" as Russell.Adams@AdamsSystems.nl. To change your subscriptions, go to http://community.ibm.com/community/user/preferences?section=Subscriptions. To unsubscribe from this community discussion, go to http://community.ibm.com/HigherLogic/eGroups/Unsubscribe.aspx?UserKey=c23dfccc-9910-40ae-beeb-fdcbced5bf1f&sKey=KeyRemoved&GroupKey=7b554d78-d4dc-417a-b4dc-017e309e5c91.


    ------------------------------------------------------------------
    Russell Adams Russell.Adams@AdamsSystems.nl
    Principal Consultant Adams Systems Consultancy
    https://adamssystems.nl/




  • 6.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Mon June 13, 2022 07:52 AM
    I think this is a one liner:

    0 0 * * * find /etc/cron.daily/ -type f -perm 0700 -name '[0-9][0-9]*.sh' -exec '{}' \;

    It only matches files like 10Local.sh and not backup files like 10Local.sh~

    On Mon, Jun 13, 2022 at 08:25:39AM +0000, Russell Adams via IBM Community wrote:
    > I'm not advocating for major changes to cron. Simply asking if this
    > had been made available where I knew it wasn't there in the past.
    >
    > I'll go look at what some of the Linux scripts are doing. Maybe I can
    > quickly port that over to AIX while being a little less "hacky". ;]
    >
    > On Mon, Jun 13, 2022 at 07:44:52AM +0000, Esa K?rkk?inen via IBM Community wrote:
    > > Hi,
    > >
    > > IMHO the short answer is no, not without replacing or at least partially rewriting the cron daemon that is used in AIX.
    > > IIRC the cron daemon used by AIX orginates from System V, because its history does not have any idea of these "newfagled" thingamabogs like "@daily", "@weekly", "@monthly", "@yearly" or "@reboot" crontab shortcuts etc introduced in newer non SystemV cron daemons.
    > >
    > > AFAIK you and others in the community can ask IBM to replace cron daemon used in AIX, using "request for proposals" RFP process.
    > >
    > > FWIW your "hacky" solution is perfectly fine, I'd add "test -x" and "echo $?" into the loop.
    > >
    > > Br, Esa
    > >
    > > ------------------------------
    > > Esa K?rkk?inen
    > > ------------------------------
    > > -------------------------------------------
    > > Original Message:
    > > Sent: Sat June 11, 2022 05:18 AM
    > > From: Russell Adams
    > > Subject: Something like cron.daily or /etc/cron.d/ for AIX?
    > >
    > > Tom,
    > >
    > > Many Linux distros (and FreeBSD!) place crontabs from packages into
    > > directories like /etc/cron.d/daily.
    > >
    > > https://unix.stackexchange.com/questions/458713/how-are-files-under-etc-cron-d-used
    >
    > Reply to Sender : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258498&SenderKey=c23dfccc-9910-40ae-beeb-fdcbced5bf1f
    >
    > Reply to Discussion : https://community.ibm.com/community/user/eGroups/PostReply?GroupId=6049&MID=258498
    >
    >
    >
    > You are subscribed to "AIX" as Russell.Adams@AdamsSystems.nl. To change your subscriptions, go to http://community.ibm.com/community/user/preferences?section=Subscriptions. To unsubscribe from this community discussion, go to http://community.ibm.com/HigherLogic/eGroups/Unsubscribe.aspx?UserKey=c23dfccc-9910-40ae-beeb-fdcbced5bf1f&sKey=KeyRemoved&GroupKey=7b554d78-d4dc-417a-b4dc-017e309e5c91.


    ------------------------------------------------------------------
    Russell Adams Russell.Adams@AdamsSystems.nl
    Principal Consultant Adams Systems Consultancy
    https://adamssystems.nl/




  • 7.  RE: Something like cron.daily or /etc/cron.d/ for AIX?

    Posted Mon June 13, 2022 03:49 AM
    Russel,

    it is what indeed is done under the hood on Linux. You can find the script /usr/bin/run-parts on your Linux distribution and it is started by a cron job, something like (on my RHEL):

    01 * * * * root run-parts /etc/cron.hourly

    I don't think it is a big deal to port it to AIX.

    /etc/cron.d is another story. It is a feature of Linux cronie and I'd like to see the feature on AIX. Together with the possibility to specify environment variables in crontab file - the same way as it is implemented on Linux.

    I added an RFE on IBM ideas portal - https://ibm-power-systems.ideas.ibm.com/ideas/AIX-I-623.

    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------