83317

How to run a TCL script to tell run in every 10 minutes?

My TCL script:

source reboot_patch.tcl set a 1 while {$a < 10} { exec reboot_patch.tcl after 60000 incr a }

I need to run "reboot_patch.tcl" script for every 1 min in my system. I wrote above script. But its running only once and its coming out.

Following is the "reboot_patch.tcl" script:

#!/usr/bin/tcl package require Expect spawn telnet 40.1.1.2 expect "*console." send "\r" expect "*ogin:" send "test\r" expect "*word:" send "test\r" expect "*>" send "clear log\r" expect "*#" send "commit \r" expect "*#"

Please suggest me a way to achieve this.

Thanks in advance.

Script to print numbers from 1 to 10 in windows 7:

#!c:\Tcl\bin\tclsh set a 1 while { $a < 11} { puts $a incr a }

I am unable to run the above script using "./" format in windows7.

Answer1:

In general, exec command will return the output of program execution. It is our responsibility to capture and print and manipulate it.

You have to print it manually like

puts [ exec ./reboot_patch.tcl ]

Or like,

set result [ exec ./reboot_patch.tcl ] puts $result

Since you are using exec without printing it's result, you have not seen anything. Then how come it got executed for the first time ? Who else can do except the following ?

source reboot_patch.tcl

Well, Since you have sourced the file and it got executed which seemed to be the first time execution but which is not actually from exec command.

<strong>Note :</strong> If you are calling any of that sourced file's proc, then only it is required to source it. As far as I can see you are not having any proc there. So, source is not required at all.

Recommend

  • Importing UMD built module using webpack leads to Critical Dependency errors
  • Can't run docker on os X with boot2docker
  • Subclipse- update working copy
  • RenderScript implementation of BLAS?
  • declare a transaction in ejb 3.0
  • MS Access 2010: Adding transaction management into a form
  • Serializable transactions not protecting me from double inserts
  • Fragment already added IllegalStateException with only one copy of fragment
  • LibGit2Sharp log remote
  • How can I fast-forward a branch without checking it out
  • Problems assigning variables to SQLite Tuples
  • psycopg2.ProgrammingError: syntax error at or near “stdin” error when trying to copy_from redshift
  • Geo Fix not working in Android SDK 2.2
  • How to prompt user that edits have been made upon changing pages or sorting in Kendo Grid
  • EOFError, what happen to my minitest selenium test? how to fix it?
  • c# linear regression given 2 sets of data
  • Find symbol dependencies in source code [closed]
  • Gforce min not supported for character in data.table
  • calling a fragment from fragment
  • Entity Framework ObjectContext: Concurrency
  • Segmentation Fault on MySQL2 / Ruby 1.9.3 / Rails 3.2
  • Time out Error in send mail
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • How to get links to open in the native browser in iOS Meteor apps?
  • Eloquent paginate function in Slim 3 project using twig
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • How to attach a node.js readable stream to a Sendgrid email?
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Spray.io: When (not) to use non-blocking route handling?
  • Updating server-side rendering client-side
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • How to pass list parameters for each object using Spring MVC?
  • Proper way to use connect-multiparty with express.js?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • MATLAB: Piecewise function in curve fitting toolbox using fittype