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"

--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER


_______________________________________________
Peterboro mailing list
Peterboro@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/peterboro

Reply via email to