Skip to content

Instantly share code, notes, and snippets.

View onsails's full-sized avatar
You only truly know it when you truly feel it

Andrey Kuznetsov onsails

You only truly know it when you truly feel it
View GitHub Profile
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
#!/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,
# lib/daemon.rb
class Daemon < DaemonSpawn::Base
def start args
while true
# ... функциональная часть
sleep 3600
end
end
# encoding utf-8
ROWS = 2
words = []
maxlength = 0
File.open("words.txt", "r") do |f|
f.each_line do |l|
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