bofh...@gmail.com writes:
> What is the easy way to create the file starting at 1 and ending at 99. I
> need to specify an integer range to a variable so I can loop and create a
> file for each file.
Hey Robin,
I am curious why you want to create these lock files. Care to share?
bundle agent main { vars: "counter" slist => expandrange("[1-99]", 1); files: "/tmp/.X$(counter)-lock" -> { "bofh2703" } create => "true", action => warn_only, perms => m("0644"); }
warning: Warning promised, need to create file '/tmp/.X1-lock' warning: Warning promised, need to create file '/tmp/.X2-lock' warning: Warning promised, need to create file '/tmp/.X3-lock' warning: Warning promised, need to create file '/tmp/.X4-lock' warning: Warning promised, need to create file '/tmp/.X5-lock' warning: Warning promised, need to create file '/tmp/.X6-lock' warning: Warning promised, need to create file '/tmp/.X7-lock' warning: Warning promised, need to create file '/tmp/.X8-lock' warning: Warning promised, need to create file '/tmp/.X9-lock' warning: Warning promised, need to create file '/tmp/.X10-lock' warning: Warning promised, need to create file '/tmp/.X11-lock' warning: Warning promised, need to create file '/tmp/.X12-lock' warning: Warning promised, need to create file '/tmp/.X13-lock' warning: Warning promised, need to create file '/tmp/.X14-lock' warning: Warning promised, need to create file '/tmp/.X15-lock' warning: Warning promised, need to create file '/tmp/.X16-lock' warning: Warning promised, need to create file '/tmp/.X17-lock' warning: Warning promised, need to create file '/tmp/.X18-lock' warning: Warning promised, need to create file '/tmp/.X19-lock' warning: Warning promised, need to create file '/tmp/.X20-lock' warning: Warning promised, need to create file '/tmp/.X21-lock' warning: Warning promised, need to create file '/tmp/.X22-lock' warning: Warning promised, need to create file '/tmp/.X23-lock' warning: Warning promised, need to create file '/tmp/.X24-lock' warning: Warning promised, need to create file '/tmp/.X25-lock' warning: Warning promised, need to create file '/tmp/.X26-lock' warning: Warning promised, need to create file '/tmp/.X27-lock' warning: Warning promised, need to create file '/tmp/.X28-lock' warning: Warning promised, need to create file '/tmp/.X29-lock' warning: Warning promised, need to create file '/tmp/.X30-lock' warning: Warning promised, need to create file '/tmp/.X31-lock' warning: Warning promised, need to create file '/tmp/.X32-lock' warning: Warning promised, need to create file '/tmp/.X33-lock' warning: Warning promised, need to create file '/tmp/.X34-lock' warning: Warning promised, need to create file '/tmp/.X35-lock' warning: Warning promised, need to create file '/tmp/.X36-lock' warning: Warning promised, need to create file '/tmp/.X37-lock' warning: Warning promised, need to create file '/tmp/.X38-lock' warning: Warning promised, need to create file '/tmp/.X39-lock' warning: Warning promised, need to create file '/tmp/.X40-lock' warning: Warning promised, need to create file '/tmp/.X41-lock' warning: Warning promised, need to create file '/tmp/.X42-lock' warning: Warning promised, need to create file '/tmp/.X43-lock' warning: Warning promised, need to create file '/tmp/.X44-lock' warning: Warning promised, need to create file '/tmp/.X45-lock' warning: Warning promised, need to create file '/tmp/.X46-lock' warning: Warning promised, need to create file '/tmp/.X47-lock' warning: Warning promised, need to create file '/tmp/.X48-lock' warning: Warning promised, need to create file '/tmp/.X49-lock' warning: Warning promised, need to create file '/tmp/.X50-lock' warning: Warning promised, need to create file '/tmp/.X51-lock' warning: Warning promised, need to create file '/tmp/.X52-lock' warning: Warning promised, need to create file '/tmp/.X53-lock' warning: Warning promised, need to create file '/tmp/.X54-lock' warning: Warning promised, need to create file '/tmp/.X55-lock' warning: Warning promised, need to create file '/tmp/.X56-lock' warning: Warning promised, need to create file '/tmp/.X57-lock' warning: Warning promised, need to create file '/tmp/.X58-lock' warning: Warning promised, need to create file '/tmp/.X59-lock' warning: Warning promised, need to create file '/tmp/.X60-lock' warning: Warning promised, need to create file '/tmp/.X61-lock' warning: Warning promised, need to create file '/tmp/.X62-lock' warning: Warning promised, need to create file '/tmp/.X63-lock' warning: Warning promised, need to create file '/tmp/.X64-lock' warning: Warning promised, need to create file '/tmp/.X65-lock' warning: Warning promised, need to create file '/tmp/.X66-lock' warning: Warning promised, need to create file '/tmp/.X67-lock' warning: Warning promised, need to create file '/tmp/.X68-lock' warning: Warning promised, need to create file '/tmp/.X69-lock' warning: Warning promised, need to create file '/tmp/.X70-lock' warning: Warning promised, need to create file '/tmp/.X71-lock' warning: Warning promised, need to create file '/tmp/.X72-lock' warning: Warning promised, need to create file '/tmp/.X73-lock' warning: Warning promised, need to create file '/tmp/.X74-lock' warning: Warning promised, need to create file '/tmp/.X75-lock' warning: Warning promised, need to create file '/tmp/.X76-lock' warning: Warning promised, need to create file '/tmp/.X77-lock' warning: Warning promised, need to create file '/tmp/.X78-lock' warning: Warning promised, need to create file '/tmp/.X79-lock' warning: Warning promised, need to create file '/tmp/.X80-lock' warning: Warning promised, need to create file '/tmp/.X81-lock' warning: Warning promised, need to create file '/tmp/.X82-lock' warning: Warning promised, need to create file '/tmp/.X83-lock' warning: Warning promised, need to create file '/tmp/.X84-lock' warning: Warning promised, need to create file '/tmp/.X85-lock' warning: Warning promised, need to create file '/tmp/.X86-lock' warning: Warning promised, need to create file '/tmp/.X87-lock' warning: Warning promised, need to create file '/tmp/.X88-lock' warning: Warning promised, need to create file '/tmp/.X89-lock' warning: Warning promised, need to create file '/tmp/.X90-lock' warning: Warning promised, need to create file '/tmp/.X91-lock' warning: Warning promised, need to create file '/tmp/.X92-lock' warning: Warning promised, need to create file '/tmp/.X93-lock' warning: Warning promised, need to create file '/tmp/.X94-lock' warning: Warning promised, need to create file '/tmp/.X95-lock' warning: Warning promised, need to create file '/tmp/.X96-lock' warning: Warning promised, need to create file '/tmp/.X97-lock' warning: Warning promised, need to create file '/tmp/.X98-lock' warning: Warning promised, need to create file '/tmp/.X99-lock'
–
Nick Anderson
Doer of things, CFEngine
Nick Anderson writes:
> #+BEGINSRC cfengine3
> bundle agent main
> {
> vars:
> "counter" slist => expandrange("[1-99]", 1);
>
> files:
> "tmp.X$(counter)-lock" -> { "bofh2703" }
> create => "true",
> action => warnonly,
> perms => m("0644");
> }
> #+ENDSRC
>
I think this is actually a better declaration, and works equally as
well.
bundle agent main { vars: "vnc_lock_files" slist => expandrange("/tmp/.X[1-99]-lock", 1); files: "$(vnc_lock_files)" -> { "bofh2703" }
I am creating the locks to prevent users from starting additional VNC sessions. We use xinetd to start VNC sessions and want to restrict users from starting additional VNC sessions. If we create the lock files then users are prevented from starting more VNC sessions. We have been moving to Exceed OnDemand so this is only a band-aid for now