Posts

Db2 connection from Python using ibm_db

Ever watch the Web Console or a list of connections to the the database and wondered who or what was " db2jcc_application"? I Just discovered how to set connection options using ibm_db connections and put my  applications name in so it shows in the application lists. here's a code example options on connections 1 2 3 4 5 6 7 8 9     try :         options3  =   {ibm_db.SQL_ATTR_INFO_PROGRAMNAME :  'pyHelmAgent' ,ibm_db.SQL_ATTR_INFO_APPLNAME:  'pyHelmAgent' }         conn_str = 'database=bludb;hostname=' + creds.chostname + ';port=50000;protocol=tcpip;uid=' + creds.conuser + ';pwd=' + creds.conpasswd         ibm_db_conn  =   ibm_db.connect(conn_str,' ',' ',options3)     except   Exception as e:i         root.exception( 'Connection Error occurred' )     <ibm_db.IBM_DBStatement  object   at  0x0000020BD5EF42D0 >APP_HANDL: 3347 , APPLICATION_NAME:pyHelmAgent, APPLICATION_ID: 127.0 . 0.1 . 57780.22052614055

Finding and Killing Linux pids

Someone left a program running for days, and its killing the server and they're  out for a long weekend.  what can you do? To find all the processes running by a user ps -fu jbrooks to see all processes running in full view as opposed to list view ps -ef Nice list of how to use ps https://www.geeksforgeeks.org/ps-command-in-linux-with-examples/ Once you have found the process[es] you can stop them from running with the kill command kill -s 9 11677 These show more, in increasing depth. https://www.howtoforge.com/linux-kill-command/ https://www.unix.com/man-page/Linux/1/kill/ https://www.man7.org/linux/man-pages/man7/signal.7.html I'm going to throw in xargs here too. This is great for killing a list of pids.  It takes the output of a command and does a "crosstab" kind of transform to allow a new command to iterate over the list as inputs ps --ppid 11438|cut -d' ' -f 2 |xargs kill finally, pkill takes the parent pid and kills the children leaving no zombies.  Th