ios kron system variables

Unanswered Question
Aug 17th, 2007

Does the IOS kron feature have system variables we can use in commands it issues?

I am looking to schedule a command (ephone-hunt statistics write-all url/filename) but am needing to customize the filename and was hoping i could use a variable to use the current date/time as part of the filename so it is unique.

Any ideas? Would EEM be able to do this?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Erick Bergquist Fri, 08/17/2007 - 22:20

Ok, I looked over that doc again (found it earlier) and there doesn't seem to be a time and/or date variable.

What I am basically looking for is to make the URL unique each time the command runs. So the filename (part of URL) is different.

So, for example, the router command would be like. I am using copy running-config to keep it simple for everyone.

copy running-config tftp://

where %date% would be expanded to be a real date so the end result is

copy running-config tftp://

or something similar. Then run it runs again the filename would be 08182007-config.txt and then 08192007-config.txt and so on.

Joe Clarke Fri, 08/17/2007 - 22:34

Here's an EEM TCL policy I wrote a while ago that does pretty much what you just described. Instead of TFTP, though, it uses FTP. It is a timer policy that requires a few environment variables to be set:

cc_cron_entry : Cron entry specifying when to run the policy

cc_ftp_server : Hostname or IP address of the FTP server

cc_ftp_path : Destination path on the FTP server

cc_ftp_user : (optional) Username for the FTP server

cc_ftp_pass : (optional) FTP user password

You should be able to modify this policy for your needs.

Erick Bergquist Fri, 08/17/2007 - 22:41

Thanks for sharing. I'll play with this and post back my TCL once I get what I need working. Are there any other tcl files I need to load on the flash (doesn't look like it, but this is my first time using EEM).

Do you mind sharing the eem config lines?

Joe Clarke Fri, 08/17/2007 - 23:14

This script requires no other supporting libraries. To register it, make a directory on flash called policies, then set the required environment variables based on the values you require. Then:

event manager directory user policy "flash:/policies"

event manager policy config_copy_policy.tcl type user

After that, it will run based on the cc_cron_entry environment variable value.


This Discussion