Hi,Aaron.
I modify the template file just as you suggested.
It did not work.
I will read the code and do some debug.

     login {
        targetname: txt = "login";
        announcement: txt = "";
        message: txt = "";

    }
    login {
        %help: short "Names and passwords for users";
        %modinfo: provides login;
        %modinfo:   default_targetname "login";
        %mandatory: $(@.targetname);
        targetname {
            %user-hidden: "XRL target name";
            %help: short "XRL target name";
            %set:;
        }

        announcement {
            %help: short "System announcement message (displayed after
login)";
            %set: program "echo '$(@)'| tee /tmp/a.txt";
            %delete: program "/bin/echo '' | tee /tmp/a.txt";
        }

        message {
            %help: short "System announcement message (displayed after
login)";
            %set: program "/bin/echo '$(@)' | tee /tmp/b.txt";
            %delete: program "/bin/echo ''| tee /tmp/b.txt";
        }
    }

r...@localhost# set login announcement nnn
[edit]
r...@localhost# commit
OK
[edit]
r...@localhost# set login announcement ooo
[edit]
r...@localhost# commit
OK
[edit]
r...@localhost# set login announcement ppp
[edit]
r...@localhost# commit
OK                                    <<<<==================>>>just use
'commit', everything is ok.
[edit]
r...@localhost#
r...@localhost# save 1.txt  <<===================>>>'save' will 'cause'
commit error
Save done.
r...@localhost# set login announcement qqq
[edit]
r...@localhost# commit
Commit Failed
tee: /tmp/a.txt: Permission denied
Command "/bin/echo": exited with exit status 1.[edit]
r...@localhost#






2009/12/2 Aaron Shang <[email protected]>

> You may try 'tee' for such purpose, such as:
>
> /bin/echo '' | tee -a /tmp/a.txt
>
> or just use 'tee' without '-a' to override the file.
>
>
> Good luck.
>
>
>
> BTW, you can attach ascii files using proper mime type in file name,
> so as to include them in most mail readers:
> $ cp test.tp test.tp.txt
>
>
>
> 2009/11/30 cheng wan <[email protected]>:
>  >
> >> Thank you, Bruce.
> >> The official document "rtrmgr.pdf"(Chapter 2.3.2) gave one example:
> >> foo {
> >> %set: program "/bin/echo -n ’$(@)' >> /tmp/file.txt";
> >> }
> >> What I wrote in test.tp was mostly like this.
> >> If I did not use "save" after "commit", everything is OK.
> >> What does "These command strings aren't guaranteed to be executed by a
> >> shell" mean?
> >> Does that mean Template Tree program Action can not support this?
> >>
> >> Best
> >> Robin
> >>
> >>
> >> 2009/11/29 Bruce Simpson <[email protected]>
> >>>
> >>> Hi,
> >>>
> >>> You seem to be using shell redirection operators ('>>') inside a XORP
> >>> template file.
> >>>
> >>> These command strings aren't guaranteed to be executed by a shell, you
> >>> are probably better off using some other means of telling your external
> >>> program(s) which files to use (e.g. command line arguments).
> >>>
> >>> cheers,
> >>> BMS
> >>
>
>
> --
> Aaron, with best regards
>
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to