Sample DB Startup Code
From Scire Wiki
Here is some sample DB code. Please keep it updated with the changes made in the DB tables.
use scire; INSERT INTO scripts (scriptid, name, description, location, script_data, log_location, success_code, run_as) values (100, 'Gentoo Update Script', 'This script will run emerge sync and emerge -u world, logging the results.', '', '#!/bin/bash \n emerge sync \n emerge -u world', '/var/log/scire/updatelog.txt', 0, 'root'); INSERT INTO scripts (scriptid, name, description, location, script_data, log_location, success_code, run_as) values (101, 'Gentoo Install Package Script', 'This script will run emerge on a given package and log the results.', '', '#!/bin/bash \n emerge ', '/var/log/scire/installlog.txt', 0, 'root'); INSERT INTO scripts (scriptid, name, description, location, script_data, log_location, success_code, run_as) values (102, 'Gentoo Uninstall Package Script', 'This script will run emerge unmerge on a given package and log the results.', '', '#!/bin/bash \n emerge unmerge', '/var/log/scire/uninstalllog.txt', 0, 'root'); INSERT INTO scripts (scriptid, name, description, location, script_data, log_location, success_code, run_as) values (103, 'Gentoo Rollback Script', 'This script will roll back a given package to its previous version, logging the results.', '', '#!/bin/bash \n emerge -C && emerge ', '/var/log/scire/rollbacklog.txt', 0, 'root'); INSERT INTO scripts (scriptid, name, description, location, script_data, log_location, success_code, run_as) values (104, 'Gentoo PackageList Script', 'This script will return a list of packages installed on the system and the current version of those packages.', '', '#!/bin/bash \n stuff here', '/var/log/scire/packagelistlog.txt', 0, 'nobody'); INSERT INTO os (osid, osname, update_script, install_script, uninstall_script, rollback_script, packagelist_script) values (1,'Gentoo Linux',100 ,101 ,102 ,103, 104 ); INSERT INTO GLI_profiles (profileid, profile_name, location, description) values (1, 'printerserver', '/scire/gli_profiles/printerserver.xml', 'A typical printer server install profile. has like cups and shit.'); INSERT INTO GLI_profiles (profileid, profile_name, location, description) values (2, 'mta', '/scire/gli_profiles/mta.xml', 'A typical MTA install profile. has like very little except mailers.'); INSERT INTO users (userid, username, password, email, phone, pager, real_name, comment) values (1, 'root','444mwGdhEKuO.', 'root@localhost.com', '', '', 'Root User', 'This is the comment for the root user.'); INSERT INTO users (userid, username, password, email, phone, pager, real_name, comment) values (2, 'codeman','444mwGdhEKuO.', 'codeman@localhost.com', '', '', 'Preston Cody', 'Project lead and developer.'); INSERT INTO clients (clientid, assetid, digest, cert, hostname, mac, ip, gli_profile, osid, status, contact, installtime) values (1, 'ASSET01', 'D0:31:71:87:87:5D:F9:75:95:49:D9:9A:62:A0:6E:BB:21:0B:AE:E9', '', 'testhostlead', '00:0a:0b:0c:0d:0e', '192.168.3.4', 1, 1, 'Installed.', 2, '2006-01-01 00:00:00'); INSERT INTO clients (clientid, assetid, digest, cert, hostname, mac, ip, gli_profile, osid, status, contact, installtime) values (2, 'ASSET02', '00:01:02:03:87:5D:F9:75:95:49:D9:9A:62:A0:6E:BB:21:0B:AE:E9', '', 'testhostslave', '00:0a:0a:0a:0d:0e', '192.168.3.5', 1, 1, 'Not Installed', 2, NOW() ); INSERT INTO clients (clientid, assetid, digest, cert, hostname, mac, ip, gli_profile, osid, status, contact, installtime) values (3, 'MTA ASSET03', '08:07:06:05:87:5D:F9:75:95:49:D9:9A:62:A0:6E:BB:21:0B:AE:E9', '', 'testhostmtalead', '0b:0b:0b:0c:0d:0e', '192.168.3.6', 2, 1, 'Installed', 2, NOW()); INSERT INTO clients (clientid, assetid, digest, cert, hostname, mac, ip, gli_profile, osid, status, contact, installtime) values (4, 'MTA ASSET04', '11:22:33:33:33:5D:F9:75:95:49:D9:9A:62:A0:6E:BB:21:0B:AE:E9', '', 'testhostmtaslave', '0c:0c:0c:0c:0d:0e', '192.168.3.7', 2,1, 'Installed', 2, '2005-12-25 00:00:00'); INSERT INTO permissions (permid, name, description, creator) values (1, 'Update Packages', 'This permission is to allow the upgrading of packages.', 1); INSERT INTO jobs (jobid, priority, created, creator, permission, script, description, pending, failed) values (1, 1, NOW(), 2, 1, 100, 'Upgrading a package on mtalead', 1,0); INSERT INTO jobs_clients (jobid, clientid) values (1, 3);
