SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Schedule a Ruby run

    This is my first posting and before I state my problem I would like to express my appreciation to those that provided WATIR and RUBY, they are wonderful products.
    I am using a scheduled BAT file to run multipul Ruby scripts on a WIN 2003 server. I am appending the script outputs to a file. As long as I am logged on all is well. When I log off the first append works fine but Ruby stays loaded and locks the file. Subseqent scripts die on the locked file. How can I tell Ruby to quit?
    Thanks

  2. #2
    SitePoint Zealot bronze trophy
    Join Date
    Jun 2004
    Location
    Stockholm, Sweden
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Process.exit or Process.exit! maybe?
    If there is a way to overcome the suffering, there is no need to worry; if there is no way to overcome the suffering, there is no point to worry.
    - Shantideva

  3. #3
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's weird that the ruby interpreter would hang around, however it shouldn't matter if you close the file every time you're done writing to it. Also you might try to ensure that the scripts aren't getting executed concurrently, so in your bat file don't use something like the start command. If you have to use the start command, then have the start command execute a single ruby script that calls the other's in sequence and then kills itself.

    Not sure if any of this information is relevant or even accurate, but I hope it helps.

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure if this is pertinent or not but are you using the block form to open and write then close your file? If not that may be the problem. Here is an example of the block form of file IO:

    File.open("myfile.txt","w+") do |file|
    file.puts my_data
    end

    If you do it this way the file will always get closed for you and ruby should not hold a lock on the file.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •