<commit_before># Amahi Home Server
# Copyright (C) 2007-2013 Amahi
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License v3
# (29 June 2007), as published in the COPYING file.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# file COPYING for more details.
# 
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Amahi
# team at http://www.amahi.org/ under "Contact Us."

require 'platform'
require 'command'

class Server < ApplicationRecord

	# CAUTION - this class *assumes* new servers are created
	# started and enabled at boot time as services!

	PID_PATH = "/var/run"

	validates_uniqueness_of :name
	validates_presence_of :name

	before_save  :before_save_hook
	after_create  :create_hook
	after_destroy  :destroy_hook

	attr_accessible :name, :pidfile, :comment

	def self.create_default_servers
		Server.create(:name => 'apache', :pidfile => Platform.file_name(:apache_pid), :comment => I18n.t('apache_web_server'))
		Server.create(:name => 'mariadb', :pidfile => 'mariadb/mariadb.pid', :comment => I18n.t('mariadb_database_server'))
		Server.create(:name => 'smb', :pidfile => Platform.file_name(:samba_pid), :comment => I18n.t('file_server_samba'))
		r = "# WARNING - This file was automatically generated on #{Time.now}\n" \
			"\nset daemon 30\n" \
			"include #{Platform.file_name(:monit_dir)}/logging\n" \
			"include #{Platform.file_name(:monit_dir)}/*.conf\n"
		fname = TempCache.unique_filename "server-conf"
		f = File.new fname, "w"
		f.write r<commit_msg>remove mariadb and apache from servers, as they are self-destructive for most naive users<commit_after># Amahi Home Server
# Copyright (C) 2007-2013 Amahi
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License v3
# (29 June 2007), as published in the COPYING file.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# file COPYING for more details.
# 
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Amahi
# team at http://www.amahi.org/ under "Contact Us."

require 'platform'
require 'command'

class Server < ApplicationRecord

	# CAUTION - this class *assumes* new servers are created
	# started and enabled at boot time as services!

	PID_PATH = "/var/run"

	validates_uniqueness_of :name
	validates_presence_of :name

	before_save  :before_save_hook
	after_create  :create_hook
	after_destroy  :destroy_hook

	attr_accessible :name, :pidfile, :comment

	def self.create_default_servers
		Server.create(:name => 'smb', :pidfile => Platform.file_name(:samba_pid), :comment => I18n.t('file_server_samba'))
		r = "# WARNING - This file was automatically generated on #{Time.now}\n" \
			"\nset daemon 30\n" \
			"include #{Platform.file_name(:monit_dir)}/logging\n" \
			"include #{Platform.file_name(:monit_dir)}/*.conf\n"
		fname = TempCache.unique_filename "server-conf"
		f = File.new fname, "w"
		f.write r
{'fraction_non_alphanumeric': 0.10222882615156018, 'fraction_numerical': 0.012481426448737, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1028923', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1043, 'n_words': 374}