diff --git a/.hg/00changelog.i b/.hg/00changelog.i new file mode 100644 index 0000000..d3a8311 Binary files /dev/null and b/.hg/00changelog.i differ diff --git a/.hg/branch b/.hg/branch new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/.hg/branch @@ -0,0 +1 @@ +default diff --git a/.hg/cache/branchheads b/.hg/cache/branchheads new file mode 100644 index 0000000..0e85566 --- /dev/null +++ b/.hg/cache/branchheads @@ -0,0 +1,2 @@ +f166d7c804e3110fa6046f672685ae28ba8c1c1b 3 +f166d7c804e3110fa6046f672685ae28ba8c1c1b default diff --git a/.hg/cache/tags b/.hg/cache/tags new file mode 100644 index 0000000..18aeb99 --- /dev/null +++ b/.hg/cache/tags @@ -0,0 +1,2 @@ +2 3d601adc63d8adf0a0c32ab305df5f1b91b81b90 + diff --git a/.hg/dirstate b/.hg/dirstate new file mode 100644 index 0000000..dab4142 Binary files /dev/null and b/.hg/dirstate differ diff --git a/.hg/last-message.txt b/.hg/last-message.txt new file mode 100644 index 0000000..4fd3d09 --- /dev/null +++ b/.hg/last-message.txt @@ -0,0 +1,4 @@ + +Added catalina_log_pull + + diff --git a/.hg/requires b/.hg/requires new file mode 100644 index 0000000..c1674f2 --- /dev/null +++ b/.hg/requires @@ -0,0 +1,4 @@ +revlogv1 +fncache +store +dotencode diff --git a/.hg/store/00changelog.i b/.hg/store/00changelog.i new file mode 100644 index 0000000..555976b Binary files /dev/null and b/.hg/store/00changelog.i differ diff --git a/.hg/store/00manifest.i b/.hg/store/00manifest.i new file mode 100644 index 0000000..50bb2b8 Binary files /dev/null and b/.hg/store/00manifest.i differ diff --git a/.hg/store/data/apache.txt.i b/.hg/store/data/apache.txt.i new file mode 100644 index 0000000..382aac4 Binary files /dev/null and b/.hg/store/data/apache.txt.i differ diff --git a/.hg/store/data/blackboard__convert__for__course__exports.sh.i b/.hg/store/data/blackboard__convert__for__course__exports.sh.i new file mode 100644 index 0000000..629aa63 Binary files /dev/null and b/.hg/store/data/blackboard__convert__for__course__exports.sh.i differ diff --git a/.hg/store/data/catalina__bb__logs__pull.sh.i b/.hg/store/data/catalina__bb__logs__pull.sh.i new file mode 100644 index 0000000..f337ba9 Binary files /dev/null and b/.hg/store/data/catalina__bb__logs__pull.sh.i differ diff --git a/.hg/store/data/foo__out.txt.i b/.hg/store/data/foo__out.txt.i new file mode 100644 index 0000000..0e2c1a9 Binary files /dev/null and b/.hg/store/data/foo__out.txt.i differ diff --git a/.hg/store/data/new__pysysinfo.py.i b/.hg/store/data/new__pysysinfo.py.i new file mode 100644 index 0000000..d431c47 Binary files /dev/null and b/.hg/store/data/new__pysysinfo.py.i differ diff --git a/.hg/store/data/pull__bb__logs.sh.i b/.hg/store/data/pull__bb__logs.sh.i new file mode 100644 index 0000000..dd70b5a Binary files /dev/null and b/.hg/store/data/pull__bb__logs.sh.i differ diff --git a/.hg/store/data/py__kill__all__by__user.py.i b/.hg/store/data/py__kill__all__by__user.py.i new file mode 100644 index 0000000..efc19b1 Binary files /dev/null and b/.hg/store/data/py__kill__all__by__user.py.i differ diff --git a/.hg/store/data/py__sys__sdtin__readline.py.i b/.hg/store/data/py__sys__sdtin__readline.py.i new file mode 100644 index 0000000..bda7c38 Binary files /dev/null and b/.hg/store/data/py__sys__sdtin__readline.py.i differ diff --git a/.hg/store/data/py__wrapper__around__xmlconversion.py.i b/.hg/store/data/py__wrapper__around__xmlconversion.py.i new file mode 100644 index 0000000..4b71703 Binary files /dev/null and b/.hg/store/data/py__wrapper__around__xmlconversion.py.i differ diff --git a/.hg/store/data/pyls.py.i b/.hg/store/data/pyls.py.i new file mode 100644 index 0000000..1fc70e3 Binary files /dev/null and b/.hg/store/data/pyls.py.i differ diff --git a/.hg/store/data/pysysinfo.py.i b/.hg/store/data/pysysinfo.py.i new file mode 100644 index 0000000..f61e022 Binary files /dev/null and b/.hg/store/data/pysysinfo.py.i differ diff --git a/.hg/store/data/pysysinfo.pyc.i b/.hg/store/data/pysysinfo.pyc.i new file mode 100644 index 0000000..fa6855a Binary files /dev/null and b/.hg/store/data/pysysinfo.pyc.i differ diff --git a/.hg/store/data/pysysinfo__fuction.py.i b/.hg/store/data/pysysinfo__fuction.py.i new file mode 100644 index 0000000..e29a5d5 Binary files /dev/null and b/.hg/store/data/pysysinfo__fuction.py.i differ diff --git a/.hg/store/data/pysysinfo__fuction.pyc.i b/.hg/store/data/pysysinfo__fuction.pyc.i new file mode 100644 index 0000000..e75478e Binary files /dev/null and b/.hg/store/data/pysysinfo__fuction.pyc.i differ diff --git a/.hg/store/data/redirect1.py.i b/.hg/store/data/redirect1.py.i new file mode 100644 index 0000000..1fa8985 Binary files /dev/null and b/.hg/store/data/redirect1.py.i differ diff --git a/.hg/store/data/ssh-copy-id.sh.i b/.hg/store/data/ssh-copy-id.sh.i new file mode 100644 index 0000000..b08abe2 Binary files /dev/null and b/.hg/store/data/ssh-copy-id.sh.i differ diff --git a/.hg/store/data/writelines__outfile.txt.i b/.hg/store/data/writelines__outfile.txt.i new file mode 100644 index 0000000..2940233 Binary files /dev/null and b/.hg/store/data/writelines__outfile.txt.i differ diff --git a/.hg/store/fncache b/.hg/store/fncache new file mode 100644 index 0000000..1e8882b --- /dev/null +++ b/.hg/store/fncache @@ -0,0 +1,17 @@ +data/pysysinfo_fuction.pyc.i +data/writelines_outfile.txt.i +data/pysysinfo.py.i +data/py_wrapper_around_xmlconversion.py.i +data/pyls.py.i +data/new_pysysinfo.py.i +data/blackboard_convert_for_course_exports.sh.i +data/pysysinfo.pyc.i +data/pull_bb_logs.sh.i +data/py_sys_sdtin_readline.py.i +data/pysysinfo_fuction.py.i +data/py_kill_all_by_user.py.i +data/catalina_bb_logs_pull.sh.i +data/foo_out.txt.i +data/apache.txt.i +data/redirect1.py.i +data/ssh-copy-id.sh.i diff --git a/.hg/store/phaseroots b/.hg/store/phaseroots new file mode 100644 index 0000000..47954f2 --- /dev/null +++ b/.hg/store/phaseroots @@ -0,0 +1 @@ +1 6a1af0b7d75c2f1ea745752441b92b9d55b7f626 diff --git a/.hg/store/undo b/.hg/store/undo new file mode 100644 index 0000000..3154598 Binary files /dev/null and b/.hg/store/undo differ diff --git a/.hg/store/undo.phaseroots b/.hg/store/undo.phaseroots new file mode 100644 index 0000000..47954f2 --- /dev/null +++ b/.hg/store/undo.phaseroots @@ -0,0 +1 @@ +1 6a1af0b7d75c2f1ea745752441b92b9d55b7f626 diff --git a/.hg/undo.bookmarks b/.hg/undo.bookmarks new file mode 100644 index 0000000..e69de29 diff --git a/.hg/undo.branch b/.hg/undo.branch new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/.hg/undo.branch @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/.hg/undo.desc b/.hg/undo.desc new file mode 100644 index 0000000..c0feb0c --- /dev/null +++ b/.hg/undo.desc @@ -0,0 +1,2 @@ +3 +commit diff --git a/.hg/undo.dirstate b/.hg/undo.dirstate new file mode 100644 index 0000000..0011991 Binary files /dev/null and b/.hg/undo.dirstate differ diff --git a/EUD_ITEM_prune_sp8upgrade.sql b/EUD_ITEM_prune_sp8upgrade.sql new file mode 100644 index 0000000..430e913 --- /dev/null +++ b/EUD_ITEM_prune_sp8upgrade.sql @@ -0,0 +1,31 @@ + +delete from EUD_ITEM where START_DATE < (sysdate - 400) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 350) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 300) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 290) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 280) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 270) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 260) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 250) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 240) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 230) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 220) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 210) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 200) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 190) and IMPORTANT_IND = 'N'; +commit; +delete from EUD_ITEM where START_DATE < (sysdate - 180) and IMPORTANT_IND = 'N'; +commit; diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/apache.txt b/apache.txt new file mode 100644 index 0000000..c466fda --- /dev/null +++ b/apache.txt @@ -0,0 +1,23 @@ +NameVirtualHost 127.0.0.1:80 + + DocumentRoot /var/www/ + + Options FollowSymLinks + AllowOverride None + + ErrorLog /var/log/apache2/error.log + LogLevel warn + CustomLog /var/log/apache2/access.log combined + ServerSignature On + + + DocumentRoot /var/www2/ + + Options FollowSymLinks + AllowOverride None + + ErrorLog /var/log/apache2/error2.log + LogLevel warn + CustomLog /var/log/apache2/access2.log combined + ServerSignature On + diff --git a/blackboard_convert_for_course_exports.sh b/blackboard_convert_for_course_exports.sh new file mode 100755 index 0000000..86f41a7 --- /dev/null +++ b/blackboard_convert_for_course_exports.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# this was created 4/13/12 to convert files from spider.its.utexas.edu:///mnt/archives/course_exports/2009_spring/remove/ to the output +# |||2009__classes +# i pulled the export.csv from courses_main table and ran this awk, i had to create a sed to get rid of all of the " "s + +# course_id = $10 +# batch_uid = $14 +# course_name = $9 + +# select course_id || '|' || batch_uid || '|' || course_name || '|2009_spring_classes' from course_main where course_id like '%2009_spring%' + +# cat 2009_spring_classes.out | sed 's/"//g' >> 2009_spring_classes_sed.out + + +for i in `cat 2009_summer_exports.bbexport` +do + COURSE_ID=`echo $i | awk -F , '{print $1}'` + grep $COURSE_ID export.csv | awk -F , '{print $10 "|" $14 "|" $9 "| 2009_summer_classes" }' >> 2009_summer_classes.out +done + +# added after the script had been completed +cat 2009_summer_classes.out | sed 's/"//g' >> 2009_summer_classes_sed.out \ No newline at end of file diff --git a/catalina_bb_logs_pull.sh b/catalina_bb_logs_pull.sh new file mode 100755 index 0000000..c61d902 --- /dev/null +++ b/catalina_bb_logs_pull.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +USER=asgharje +DATE=`date +%F` +TOMCAT_DATE=`date +%Y%m%d` +BB_DATE=`date +%Y-%m-%d` + +# +# Create the directory +# +mkdir $DATE +cd $DATE + +# +# Pull the files down +# +for i in "spider.its.utexas.edu" "maeve.its.utexas.edu" "nancy.its.utexas.edu" "tristran.its.utexas.edu" "rosie.its.utexas.edu" +do + echo "" + echo "Now pulling from $i" + echo "" + scp -C $USER@$i:/usr/local/blackboard/logs/tomcat/catalina-log.txt $DATE.$i.catalina-log.txt + echo "" + echo "Done with $i" + echo "" +done + +# +# gzip the files +# +gzip * +cd .. + +# +# tar up the directory into a tarball +# +tar zcf catalina_log_pull.$DATE.tar.gz $DATE/ + +# +# Delete the $DATE/ directory +# +rm -rf $DATE/ + +# Complete +echo "Your file name is catalina_log_pull.$DATE.tar.gz" + diff --git a/create_vm_tmp.sh b/create_vm_tmp.sh new file mode 100755 index 0000000..9e515ae --- /dev/null +++ b/create_vm_tmp.sh @@ -0,0 +1,49 @@ +#!/usr/local/bin/bash + +VDI_DIR='/home/asgharje/vdi/' +UBUNTU_GOLD_VDI="ubuntu_11_10_gold.vdi" +REDHAT_GOLD_VDI="centos_6_2_gold.vdi" +HOST_NIC="em0" + + +echo "Name of VM" +read name_of_vm +echo "OS type (Ubuntu, RedHat_64)" +read ostype +cd $VDI_DIR +if [ "$ostype" = "Ubuntu" ]; then + echo "Cloning Ubuntu vdi" + VBoxManage clonehd $UBUNTU_GOLD_VDI ubuntu_11_10_$name_of_vm.vdi +elif [ "$ostype" = "RedHat_64" ]; then + echo "Cloning RedHat vdi" + VBoxManage clonehd $REDHAT_GOLD_VDI centos_6_2_$name_of_vm.vdi +else + clear; + echo "something broke" +fi +VBoxManage createvm --name "$name_of_vm" --ostype "$ostype" -register +echo "Adding 4gigs of memory" +VBoxManage modifyvm "$name_of_vm" --memory 4096 --boot1 dvd +echo "Adding the storage ide controller" +VBoxManage storagectl "$name_of_vm" --name "IDE Controller" --add ide +echo "Attaching vdi to storage controller" +if [ "$ostype" = "Ubuntu" ]; then + VBoxManage storageattach "$name_of_vm" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ubuntu_11_10_$name_of_vm.vdi +fi +if [ "$ostype" = "RedHat_64" ]; then + VBoxManage storageattach "$name_of_vm" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium centos_6_2_$name_of_vm.vdi +fi +echo "Adding NIC and making it a bridge adapter" +VBoxManage modifyvm "$name_of_vm" --nic1 bridged --nictype1 82543GC --bridgeadapter1 $HOST_NIC +clear +echo "" +echo "" +echo "" +echo "Starting it in headless mode have fun!" +echo "" +echo "" +echo "Check the NIC, it could change and you'll have to edit it via the console, hence the VNC connection here in a sec" +echo "" +echo "" +VBoxHeadless -s "$name_of_vm" -n +cd $HOME \ No newline at end of file diff --git a/foo_out.txt b/foo_out.txt new file mode 100644 index 0000000..44deaf5 --- /dev/null +++ b/foo_out.txt @@ -0,0 +1,2 @@ +This is something becasue i want something +BLah! diff --git a/length.sh b/length.sh new file mode 100755 index 0000000..e237b7f --- /dev/null +++ b/length.sh @@ -0,0 +1,13 @@ +#!/bin/bash +echo "enter the sting: " +read str; + +countStringLength() { + echo `echo -n $1 | wc -c` + + # Or can use the below trick to get the string length + # I prefer to use the first one - easy to use and easy to remember + echo ${#1} +} +countStringLength $str + diff --git a/new_pysysinfo.py b/new_pysysinfo.py new file mode 100755 index 0000000..5f12788 --- /dev/null +++ b/new_pysysinfo.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +#very short script thta reuses pysysinfo + +from pysysinfo_fuction import disk_func +import subprocess + +def tmp_space(): + tmp_usage = 'du' + tmp_arg = '-h' + path = '/tmp/' + print "Space used in /tmp directory" + subprocess.call([tmp_usage, tmp_arg, path]) + +def main(): + disk_func() + + tmp_space() + +if __name__ == "__main__": + main() diff --git a/nuke_vm_tmp.sh b/nuke_vm_tmp.sh new file mode 100755 index 0000000..aad5a63 --- /dev/null +++ b/nuke_vm_tmp.sh @@ -0,0 +1,12 @@ +#!/usr/local/bin/bash + +VDI_DIR='/home/asgharje/vdi/' +UBUNTU_GOLD_VDI="ubuntu_11_10_gold.vdi" +REDHAT_GOLD_VDI="centos_6_2_gold.vdi" + + +echo "Name of VM" +read name_of_vm +VBoxManage unregistervm "$name_of_vm" --delete +cd $VDI_DIR +rm *_$name_of_vm.vdi diff --git a/pull_bb_logs.sh b/pull_bb_logs.sh new file mode 100755 index 0000000..993e7c7 --- /dev/null +++ b/pull_bb_logs.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +USER=asgharje +DATE=`date +%F` +TOMCAT_DATE=`date +%Y%m%d` +BB_DATE=`date +%Y-%m-%d` + +# +# Create the directory +# +mkdir $DATE +cd $DATE + +# +# Pull the files down +# +for i in "spider.its.utexas.edu" "maeve.its.utexas.edu" "nancy.its.utexas.edu" "tristran.its.utexas.edu" "rosie.its.utexas.edu" +do + echo "" + echo "Now pulling from $i" + echo "" + scp -C $USER@$i:/usr/local/blackboard/config/bb-config.properties $DATE.$i.bb-config.properties + scp -C $USER@$i:/usr/local/blackboard/logs/bb-sqlerror-log.$BB_DATE.txt $DATE.$i.bb-sqlerror-log.$BB_DATE.txt + scp -C $USER@$i:/usr/local/blackboard/logs/bb-sqlerror-log.txt $DATE.$i.bb-sqlerror-log.txt + scp -C $USER@$i:/usr/local/blackboard/logs/tomcat/stdout-stderr-$TOMCAT_DATE.log $DATE.$i.stdout-stderr.txt + scp -C $USER@$i:/usr/local/blackboard/logs/httpd/error_log $DATE.$i.error_log + scp -C $USER@$i:/usr/local/blackboard/logs/httpd/mod_jk.log $DATE.$i.mod_jk.log + scp -C $USER@$i:/usr/local/blackboard/config/bb-tasks.xml $DATE.$i.bb-tasks.xml + scp -C $USER@$i:/usr/local/blackboard/config/bb-tasks.unix.xml $DATE.$i.bb-tasks.unix.xml + scp -C $USER@$i:/usr/local/blackboard/logs/tomcat/catalina-log.txt $DATE.$i.catalina-log.txt + echo "" + echo "Done with $i" + echo "" +done + +# +# gzip the files +# +gzip * +cd .. + +# +# tar up the directory into a tarball +# +tar zcf bb_log_pull.$DATE.tar.gz $DATE/ + +# +# Delete the $DATE/ directory +# +rm -rf $DATE/ + +# Complete +echo "Your file name is bb_log_pull.$DATE.tar.gz" + diff --git a/py_kill_all_by_user.py b/py_kill_all_by_user.py new file mode 100755 index 0000000..da16c15 --- /dev/null +++ b/py_kill_all_by_user.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# +# This is an attempt to kill all procs by an owner +# + +import os +import sys +import subprocess + +def main(): + if (len(sys.argv) > 1): + ps_grep(sys.argv[1:]) + else: + print "no args" + +def ps_grep(u): + ps="ps" + psopt="-ej" + grep="grep" + cmd="ps aux |grep " + for i in u: + + ## James suggested this is "cleaner" + #p1=subprocess.Popen([ps,psopt],stdout=subprocess.PIPE) + #p2=subprocess.Popen([grep, i],stdin=p1.stdout,stdout=subprocess.PIPE) + #p1.stdout.close() + #print p2.communicate()[0] + ## + + ## This just "works" + subprocess.call(cmd + i, shell=True) + + +if __name__ == "__main__": + main() diff --git a/py_sys_sdtin_readline.py b/py_sys_sdtin_readline.py new file mode 100755 index 0000000..8dde14a --- /dev/null +++ b/py_sys_sdtin_readline.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +import sys + +counter = 1 + +while True: + line = sys.stdin.readline() + if not line: + break +print "%s: %s" % (counter, line) +counter += 1 diff --git a/py_wrapper_around_xmlconversion.py b/py_wrapper_around_xmlconversion.py new file mode 100755 index 0000000..7960ed1 --- /dev/null +++ b/py_wrapper_around_xmlconversion.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Presteps +# export CMI=/usr/local/footprints + +# first i need to call the script +# a) this checks asks for the original "MASTERXX" and confirms this, then asks for what its supposed to be, "MASTERYY" +# b) /usr/footprints_perl/bin/perl mrXMLConversion.pl --project=YY +# var = "/some/file/path/" +# pipe = subprocess.Popen(["perl", "uireplace.pl", var]) + +# second i need to run the script +# a) this includes the options that are asked by the script, "y, n, y, y, y" + +# third takes the data for the failure + +# forth check it against an array of known "good" names + +# fifth if not part of that known good list, grep out the name from the xml file +# a) confirm that the name matches the name and write it to a file + +# sixth delete every entry for that name +# #!/bin/bash +# make a back up! changes in place! +# +#[ -s "$1" ] || (echo "no file $1" && exit) +#if [ ! $# -eq 2 ]; then +# echo "wrong args $# : $@" +# exit +#fi +#sed -ri "s#<$2>(.+)##g" "$1" + +# rerun the script +# a) if successful output the data to a log file and complete the script diff --git a/pyls.py b/pyls.py new file mode 100755 index 0000000..b97730d --- /dev/null +++ b/pyls.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python +#Python wrapper for ls + +import subprocess + +subprocess.call(["ls","-l"]) diff --git a/pysysinfo.py b/pysysinfo.py new file mode 100755 index 0000000..5f80019 --- /dev/null +++ b/pysysinfo.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# coding: utf-8 + +#A System Information Gathering Script +import subprocess + +#Command 1 +uname = 'uname' +uname_arg = '-a' +print "Gathering system information with %s command:\n" % uname +subprocess.call([uname, uname_arg]) + +#Command 2 +diskspace = 'df' +diskspace_arg = '-h' +print "Gathering diskspace information %s command:\n" % diskspace +subprocess.call([diskspace, diskspace_arg]) +print "also this" +subprocess.call("df -h", shell=True) diff --git a/pysysinfo.pyc b/pysysinfo.pyc new file mode 100644 index 0000000..272e9f0 Binary files /dev/null and b/pysysinfo.pyc differ diff --git a/pysysinfo_fuction.py b/pysysinfo_fuction.py new file mode 100755 index 0000000..ddc668c --- /dev/null +++ b/pysysinfo_fuction.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import subprocess + +def uname_func(): + + uname='uname' + uname_arg = '-a' + print "Gathering data with %s command:\n" % uname + subprocess.call([uname, uname_arg]) + +def disk_func(): + + diskspace = 'df' + diskspace_arg = '-h' + print "Gathering data with %s command:\n" % diskspace + subprocess.call([diskspace, diskspace_arg]) + +def main(): + uname_func() + disk_func() + + +if __name__ == "__main__": + main() diff --git a/pysysinfo_fuction.pyc b/pysysinfo_fuction.pyc new file mode 100644 index 0000000..3447336 Binary files /dev/null and b/pysysinfo_fuction.pyc differ diff --git a/redirect1.py b/redirect1.py new file mode 100755 index 0000000..6f701dc --- /dev/null +++ b/redirect1.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +import sys +while 1: + try: + input = sys.stdin.readline() + if input: + sys.stdout.write('Echo to stdout: %s'%input) + sys.stderr.write('Echo to stderr: %s'%input) + except KeyboardError: + sys.exit() diff --git a/ssh-copy-id.sh b/ssh-copy-id.sh new file mode 100755 index 0000000..c8ae734 --- /dev/null +++ b/ssh-copy-id.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +# Shell script to install your public key on a remote machine +# Takes the remote machine name as an argument. +# Obviously, the remote machine must accept password authentication, +# or one of the other keys in your ssh-agent, for this to work. +# +# http://www.devthought.com/2009/09/19/get-ssh-copy-id-in-mac-os-x/ +# + +ID_FILE="${HOME}/.ssh/id_rsa.pub" + +if [ "-i" = "$1" ]; then + shift + # check if we have 2 parameters left, if so the first is the new ID file + if [ -n "$2" ]; then + if expr "$1" : ".*\.pub" > /dev/null ; then + ID_FILE="$1" + else + ID_FILE="$1.pub" + fi + shift # and this should leave $1 as the target name + fi +else + if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then + GET_ID="$GET_ID ssh-add -L" + fi +fi + +if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then + GET_ID="cat ${ID_FILE}" +fi + +if [ -z "`eval $GET_ID`" ]; then + echo "$0: ERROR: No identities found" >&2 + exit 1 +fi + +if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2 + exit 1 +fi + +# strip any trailing colon +host=`echo $1 | sed 's/:$//'` + +{ eval "$GET_ID" ; } | ssh $host "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys" || exit 1 + +cat <