Any good reason not to use separate files in /etc/cron.d or are you updating user crontabs?
One option would be to keep a directory of all the crontab sections and rebuild the crontab each time a section is updated. To install/update, you can just copy from the project directory. All you would need to do to rebuild it is cat all the sections together. Tony Cowderoy On 20/06/2012 09:19, Mark Rogers wrote: > On 19/06/12 20:22, Tony Vroon wrote: >> Have you considered the use of (unified!) diffs and the patch command? > > No, I hadn't, good idea if it'll do what I need. > > However, one thing I do want to achieve is that the file to be > "inserted" is basically a copy+paste of the required lines from a > working crontab (the files won't be created by me). > > The background to this is I'm trying to write a script to > automatically install web-based apps onto Linux boxes. Whoever wrote > the app will know how to add entries to crontab as necessary, and will > create a crontab file in the project directory. My installer needs to > see if that file is there, and insert into crontab as necessary. If > the install script gets re-run it needs to remove the previous entries > and replace them with the new crontab (in case they've changed). > > I'm not sure how to create a diff file that basically says "look for > this section, and if it's there remove it (whatever its contents), and > then append this one" > _______________________________________________ Peterboro mailing list [email protected] https://mailman.lug.org.uk/mailman/listinfo/peterboro
