[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
another crontab example
From: |
Brendan Strejcek |
Subject: |
another crontab example |
Date: |
Mon, 1 Mar 2004 17:17:23 -0600 |
User-agent: |
Mutt/1.3.28i |
Posted to the faq-o-matic also. Comments welcome.
Note how I am trying to simulate different namespaces by making actions
conditional upon a class which should only get set in the local
actionsequence. Is this what others do?
# begin cf.crontab_example
# tested on openbsd 3.4, should work in other environments
control:
actionsequence = (
shellcommands.cf_crontab_example_first # check out crontab
editfiles.cf_crontab_example # edit crontab
shellcommands.cf_crontab_example_second # check in crontab
)
editmark = ( "edited by cfagent (cf.crontab_example)" )
crontab_tmp = ( ExecResult(/usr/bin/mktemp) )
editfiles:
cf_crontab_example::
# this file is checked out and checked in using shellcommands
{ ${crontab_tmp}
# some edits...
PrependIfNoSuchLine "# ${editmark}"
}
shellcommands:
cf_crontab_example_first::
# chekout the crontab so it can be edited with editfiles
"/usr/bin/crontab -l | sed 1,3d >${crontab_tmp}"
cf_crontab_example_second::
"/bin/cat ${crontab_tmp} | /usr/bin/crontab -"
"/bin/rm -f ${crontab_tmp}"
# end cf.crontab_example
- another crontab example,
Brendan Strejcek <=