Compare commits
No commits in common. "65e67911664f0ff692404690fa73effa32897976" and "83c714ad31ef2892e74bf9947ae9a652fd5bceea" have entirely different histories.
65e6791166
...
83c714ad31
32
lib.cf
32
lib.cf
|
@ -117,35 +117,3 @@ body contain wmde_cmd_useshell
|
||||||
useshell=>"useshell";
|
useshell=>"useshell";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bundle agent download_and_untar(
|
|
||||||
name,
|
|
||||||
sync_src,
|
|
||||||
sync_dst,
|
|
||||||
install_dir,
|
|
||||||
test_file
|
|
||||||
)
|
|
||||||
{
|
|
||||||
classes:
|
|
||||||
"$(name)_untar" expression => not(fileexists("$(test_file)"));
|
|
||||||
|
|
||||||
files:
|
|
||||||
"$(sync_dst)"
|
|
||||||
copy_from => sync_cp("$(sync_src)","$(sys.policy_hub)"),
|
|
||||||
handle => "$(name)_tgz_copied",
|
|
||||||
classes => if_repaired ("$(name)_untar"),
|
|
||||||
perms => m(644);
|
|
||||||
|
|
||||||
commands:
|
|
||||||
|
|
||||||
"$(name)_untar"::
|
|
||||||
"/usr/bin/tar"
|
|
||||||
args => "xzvf $(sync_dst) -C $(install_dir)",
|
|
||||||
depends_on => {"$(name)_tgz_copied"},
|
|
||||||
handle => "$(name)_untarred";
|
|
||||||
reports:
|
|
||||||
# "TESTFILE: $(test_file)";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
20
mysql.cf
20
mysql.cf
|
@ -131,19 +131,12 @@ vars:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Create cronjob
|
|
||||||
# @param cfg definition for database, db_user, db_host, db_pass, db_name
|
|
||||||
# @param file file to dump database into
|
|
||||||
# @table_name a table in the database which has to exist, if not no dump will be done
|
|
||||||
# @run "true" or "false", means create cron job or not
|
|
||||||
#
|
|
||||||
bundle agent create_mysql_backup_cron_job(cfg,file,table_name,run)
|
bundle agent create_mysql_backup_cron_job(cfg,file,table_name,run)
|
||||||
{
|
{
|
||||||
classes:
|
classes:
|
||||||
"create_cron" expression => strcmp("$(run)","true");
|
"create_cron" expression => strcmp("$(run)","true");
|
||||||
vars:
|
vars:
|
||||||
"table_exists_cmd" string => '$(mysql.mysql_cmd) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" | grep -q $(table_name)';
|
"table_exists_cmd" string => '$(mysql.mysql_cmd) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" $(cfg[db_name]) | grep -q $(table_name)';
|
||||||
"backup_cmd" string => "$(mysql.mysqldump_cmd) --complete-insert --routines --triggers --single-transaction --max_allowed_packet=512M -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) >$(file)";
|
"backup_cmd" string => "$(mysql.mysqldump_cmd) --complete-insert --routines --triggers --single-transaction --max_allowed_packet=512M -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) >$(file)";
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,14 +180,3 @@ commands:
|
||||||
|
|
||||||
reports:
|
reports:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bundle agent restore_mysql_db(cfg,file)
|
|
||||||
{
|
|
||||||
commands:
|
|
||||||
"$(mysql.mysql_cmd)"
|
|
||||||
args => "-h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) < $(file)",
|
|
||||||
contain => wmde_cmd_useshell;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
98
roundcube.cf
98
roundcube.cf
|
@ -1,98 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
bundle agent roundcube(cfg)
|
|
||||||
{
|
|
||||||
classes:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"roundcube_untar" expression => not(fileexists("$(cfg[install_sub_dir])/index.php"));
|
|
||||||
"config_exists" expression => fileexists("$(cfg[install_sub_dir])/config/config.inc.php");
|
|
||||||
"backup_config_exists" expression => fileexists("$(cfg[backup_dir])/config.inc.php");
|
|
||||||
|
|
||||||
|
|
||||||
"run_backups" expression => isvariable("cfg[backup_dir]");
|
|
||||||
|
|
||||||
|
|
||||||
run_backups::
|
|
||||||
"backup_config_exists" expression => fileexists("$(cfg[backup_dir])/config.inc.php");
|
|
||||||
"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/roundcube.sql");
|
|
||||||
|
|
||||||
run_backups::
|
|
||||||
|
|
||||||
vars:
|
|
||||||
"dlfile" string => "$(sys.workdir)/data/public/$(cfg[src_tgz])";
|
|
||||||
files:
|
|
||||||
"$(dlfile)"
|
|
||||||
copy_from => remote_dcp("$(def.hub_public_dir)/$(cfg[src_tgz])","$(sys.policy_hub)"),
|
|
||||||
handle => "roundcube_tgz_copied",
|
|
||||||
classes => if_repaired ("roundcube_untar"),
|
|
||||||
perms => m(644);
|
|
||||||
|
|
||||||
"$(cfg[install_dir])/public"
|
|
||||||
link_from => ln_s("$(cfg[install_sub_dir])"),
|
|
||||||
move_obstructions => "true",
|
|
||||||
depends_on => {"roundcube_untarred"};
|
|
||||||
|
|
||||||
run_backups&(!config_exists)&backup_config_exists::
|
|
||||||
"$(cfg[install_sub_dir])/config/config.inc.php"
|
|
||||||
copy_from => local_cp("$(cfg[backup_dir])/config.inc.php"),
|
|
||||||
perms => m("644"),
|
|
||||||
classes => if_repaired("roundcube_config_repaired"),
|
|
||||||
depends_on => {"roundcube_untarred"};
|
|
||||||
|
|
||||||
run_backups&config_exists::
|
|
||||||
"$(cfg[backup_dir])/config.inc.php"
|
|
||||||
copy_from => local_dcp("$(cfg[install_sub_dir])/config/config.inc.php"),
|
|
||||||
depends_on => {"roundcube_untarred"};
|
|
||||||
|
|
||||||
methods:
|
|
||||||
"any" usebundle => mysql_table_exists(@(cfg),"users");
|
|
||||||
|
|
||||||
config_exists|roundcube_configr_repaired::
|
|
||||||
"any" usebundle => rm_rf ("$(cfg[install_sub_dir])/installer");
|
|
||||||
|
|
||||||
commands:
|
|
||||||
roundcube_untar::
|
|
||||||
"/usr/bin/tar"
|
|
||||||
args => "xzvf $(dlfile) -C $(cfg[install_dir])",
|
|
||||||
depends_on => {"roundcube_tgz_copied"},
|
|
||||||
handle => "roundcube_untarred";
|
|
||||||
!roundcube_untar::
|
|
||||||
"/usr/bin/true"
|
|
||||||
inform => "false",
|
|
||||||
depends_on => {"roundcube_tgz_copied"},
|
|
||||||
handle => "roundcube_untarred";
|
|
||||||
|
|
||||||
"run_backups&sql_backup_exists&(!mysql_$(cfg[db_name])_users_exists)"::
|
|
||||||
"$(mysql.mysql_cmd)"
|
|
||||||
args => "-h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) < $(cfg[backup_dir])/roundcube.sql",
|
|
||||||
contain => wmde_cmd_useshell;
|
|
||||||
|
|
||||||
methods:
|
|
||||||
run_backups::
|
|
||||||
# "any" usebundle => mysql_backup_db(@(cfg),"$(cfg[backup_dir])/roundcube.sql");
|
|
||||||
"any" usebundle => create_mysql_backup_cron_job(@(cfg),"$(cfg[backup_dir])/roundcube.sql","users","true");
|
|
||||||
!run_backups::
|
|
||||||
"any" usebundle => create_mysql_backup_cron_job(@(cfg),"$(cfg[backup_dir])/roundcube.sql","users","false");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reports:
|
|
||||||
# "mysql_$(cfg[db_name])_users_exists"::
|
|
||||||
# "DB EXISTS! ROUNDCUBE";
|
|
||||||
|
|
||||||
# "sql_backup_exists"::
|
|
||||||
# "SQL_BACKUP_EXISTS FILE $(cfg[backup_dir])/roundcube.sql"
|
|
||||||
# ;
|
|
||||||
|
|
||||||
# run_backups&(!config_exists)&backup_config_exists::
|
|
||||||
# "ROUNDCUBE CAN RESTORE config";
|
|
||||||
|
|
||||||
# "run_backups"::
|
|
||||||
# "ROUNDCUBE SHOULD RUN BACKUPS";
|
|
||||||
}
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ files:
|
||||||
handle => "vimbadmin_workdir_created";
|
handle => "vimbadmin_workdir_created";
|
||||||
|
|
||||||
"$(sys.workdir)/data/public/vimbadmin.tgz"
|
"$(sys.workdir)/data/public/vimbadmin.tgz"
|
||||||
copy_from => remote_dcp("$(cfg[src_tgz])","$(sys.policy_hub)"),
|
copy_from => sync_cp("$(cfg[src_tgz])","$(sys.policy_hub)"),
|
||||||
handle => "vimbadmin_tgz_copied",
|
handle => "vimbadmin_tgz_copied",
|
||||||
depends_on => {"vimbadmin_workdir_created"},
|
depends_on => {"vimbadmin_workdir_created"},
|
||||||
perms => m(644),
|
perms => m(644),
|
||||||
|
|
Loading…
Reference in New Issue