[Xorp-hackers] Hi,all. Is this a bug or just a mistake config?
cheng wan
wancheng82 at gmail.com
Tue Dec 1 22:50:11 PST 2009
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";
}
}
rwan at localhost# set login announcement nnn
[edit]
rwan at localhost# commit
OK
[edit]
rwan at localhost# set login announcement ooo
[edit]
rwan at localhost# commit
OK
[edit]
rwan at localhost# set login announcement ppp
[edit]
rwan at localhost# commit
OK <<<<==================>>>just use
'commit', everything is ok.
[edit]
rwan at localhost#
rwan at localhost# save 1.txt <<===================>>>'save' will 'cause'
commit error
Save done.
rwan at localhost# set login announcement qqq
[edit]
rwan at localhost# commit
Commit Failed
tee: /tmp/a.txt: Permission denied
Command "/bin/echo": exited with exit status 1.[edit]
rwan at localhost#
2009/12/2 Aaron Shang <aaronshang at gmail.com>
> 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 <wancheng82 at gmail.com>:
> >
> >> 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 <bms at incunabulum.net>
> >>>
> >>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20091202/ebf03989/attachment.html
More information about the Xorp-hackers
mailing list