# File lib/main/daemon.rb, line 31
    def setup!
      @dotdir = @main.dotdir

      @dirname = File.expand_path(File.dirname(@script))
      @basename = File.basename(@script)
      @script_dir = File.expand_path(File.dirname(@script))

      @daemon_dir = File.join(@dotdir, 'daemon')

      @lock_file = File.join(@daemon_dir, 'lock')
      @log_file = File.join(@daemon_dir, 'log')
      @pid_file = File.join(@daemon_dir, 'pid')
      @stdin_file = File.join(@daemon_dir, 'stdin')
      @stdout_file = File.join(@daemon_dir, 'stdout')
      @stderr_file = File.join(@daemon_dir, 'stderr')

      FileUtils.mkdir_p(@daemon_dir) rescue nil

      %w( lock log pid stdin stdout stderr ).each do |which|
        file = instance_variable_get("@#{ which }_file")
        FileUtils.touch(file)
      end

      @started_at = Time.now

      @ppid = Process.pid

      STDOUT.sync = true
      STDERR.sync = true

      self
    end