This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :daemon do | |
| task :restart do | |
| run <<-CMD | |
| cd #{latest_release}; | |
| RAILS_ENV=production script/cron stop; | |
| RAILS_ENV=production script/cron start; | |
| CMD | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require File.dirname(__FILE__) + '/../config/boot' | |
| require "#{RAILS_ROOT}/config/environment" | |
| File.open "log/daemon.log", "w" if !File.exists? "log/daemon.log" | |
| Daemon.spawn! :log_file => "#{RAILS_ROOT}/log/daemon.log", | |
| :pid_file => "#{RAILS_ROOT}/tmp/pids/daemon.pid", | |
| :sync_log => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # lib/daemon.rb | |
| class Daemon < DaemonSpawn::Base | |
| def start args | |
| while true | |
| # ... функциональная часть | |
| sleep 3600 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding utf-8 | |
| ROWS = 2 | |
| words = [] | |
| maxlength = 0 | |
| File.open("words.txt", "r") do |f| | |
| f.each_line do |l| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1 require "rubygems" | |
| 2 require 'adhearsion' | |
| 3 require 'adhearsion/voip/asterisk/manager_interface' | |
| 4 class DropsController < ApplicationController | |
| 5 include Adhearsion::VoIP::Asterisk::Manager | |
| 6 include Adhearsion::VoIP::Asterisk::Commands | |
| 7 AMI_SERVER = "localhost" | |
| 8 AMI_USER_NAME = "admin" | |
| 9 AMI_PASSWORD = "amp111" | |
| 10 def show |
NewerOlder