Hi all,

Sorry for the follow up on this, there was some conversation about this service this morning (and the breakage in build 17 that this bug fixes)

On 03/20/13 11:07 AM, Erik Trauschke wrote:
On 03/19/13 01:51 PM, Tim Foster wrote:
https://cr.opensolaris.org/action/browse/pkg/timf/add-cronjob/add_cronjob-webrev

154: nit: /contains/contain/

you're testing only for the existence of ${CMD} in the whole crontab.
How likely is it that this test might find something the user put in
there (or asked differently, how unique is ${CMD})?

in particular, how it should deal with users that have commented out the crontab entry the service creates. I've a one-line change here that specifically looks for uncommented entries when deciding to add a new entry that I'd like to include with this putback:

---
diff --git a/src/svc/pkg5_include.sh b/src/svc/pkg5_include.sh
--- a/src/svc/pkg5_include.sh
+++ b/src/svc/pkg5_include.sh
@@ -152,7 +152,7 @@
        $CRONTAB -l > $current_crontab
        EXIT=0
        # if the crontab doesn't already contain our command, add it
-       $GREP -q " $CMD"$ $current_crontab
+       $GREP -q "^[0-9, \*]+ $CMD"$ $current_crontab
        if [ $? -ne 0 ]; then
                $GREP -v " ${CMD}"$ $current_crontab > $new_crontab
                echo "$SCHEDULE $CMD" >> $new_crontab

---

the upshot is, if you've manually commented out the crontab entry, then by enabling the service, it will always add it back in.

Without this change, if you enable the service, then comment-out the crontab entry, and stop/start the service, the service will appear to be online without the cronjob ever actually firing, which seems like a worse user-experience to me.

I know this risks confusing the user ("Hey, I commented out that cron entry, how come it keeps coming back!?") but ultimately, I hope that some work elsewhere will help us from needing to deal with cron at all, so this will be a short-lived annoyance at worst.

        cheers,
                        tim
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to