From 3e5e0976e8bdc7b1cb4f7cde8da67641fbcec015 Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Mon, 22 Jun 2009 19:51:09 +0000 Subject: [PATCH] run certain scripts periodically run certain scripts at startup use plcquery instead of getusersfromplc give 'priv' argument to adduserstort.pl --- rt3/adduserstort.pl | 11 ++++++++--- rt3/getusersfromplc.py | 11 ----------- rt3/monitor-rt3.init | 22 ++++++++-------------- rt3/{syncrtusers.cron => rt.cron} | 0 rt3/rtcron.d/syncadmins.sh | 8 ++++++++ rt3/rtcron.d/syncusers.sh | 7 +++++++ rt3/rtcron.sh | 6 ++++++ 7 files changed, 37 insertions(+), 28 deletions(-) delete mode 100755 rt3/getusersfromplc.py rename rt3/{syncrtusers.cron => rt.cron} (100%) create mode 100644 rt3/rtcron.d/syncadmins.sh create mode 100644 rt3/rtcron.d/syncusers.sh create mode 100755 rt3/rtcron.sh diff --git a/rt3/adduserstort.pl b/rt3/adduserstort.pl index 899e4ce..91ff801 100644 --- a/rt3/adduserstort.pl +++ b/rt3/adduserstort.pl @@ -25,8 +25,13 @@ my $organization = ''; my $address1 = ''; my $city = ''; my $country = ''; +my $priv = 0; -print $ARGV[0]; +if ( $ARGV[0] == 'priv' ) +{ + shift @ARGV; + $priv = 1; +} open(USERS_DATA, $ARGV[0]) || die("Could not open file!"); @raw_data=; @@ -42,8 +47,8 @@ foreach $bc_user (@raw_data) RealName => $realname, EmailAddress => $email_address, Password => 'Passw0rd', - Organization => $organization, - Privileged => 0); + Organization => $organization, + Privileged => $priv); #Address1 => $address1, #City => $city, #Country => country, diff --git a/rt3/getusersfromplc.py b/rt3/getusersfromplc.py deleted file mode 100755 index da2c959..0000000 --- a/rt3/getusersfromplc.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python - -from monitor.wrapper import plc - -api = plc.api - -sites = api.GetSites({'login_base' : 'princeton'}, ['person_ids', 'name']) -for s in sites: - persons = api.GetPersons(sites[0]['person_ids'], ['email' , 'first_name', 'last_name',]) - for p in persons: - print "%s,%s %s,%s" % (p['email'], p['first_name'], p['last_name'], s['name']) diff --git a/rt3/monitor-rt3.init b/rt3/monitor-rt3.init index ca94353..15c85cd 100644 --- a/rt3/monitor-rt3.init +++ b/rt3/monitor-rt3.init @@ -122,24 +122,18 @@ function check_rt_init () { if [ ! -f /etc/rt3/setup.finished ] ; then /usr/sbin/rt-setup-database --action init --dba postgres - for f in $MONITORPATH/rt3/rtinit.d/*.pl ; do + for f in $MONITORPATH/rt3/rtconf.d/*.pl ; do /usr/sbin/rt-setup-database --action insert --dba postgres --datafile $f done - touch /etc/rt3/setup.finished - ###Last DB adjustments - #setup custom field values - cat <