Terminal Heroes 8: Memory usage scripts

Posted by Ktoso under coding, terminal heroes (No Respond)

I have a low-memory VPS running online and thus always have to worry about what uses how much memory… Of course top and my favorite htop are very good tools to check this, but sometimes I just want to get a super simple report if I’m overusing memory or not yet. The bellow scripts (most [...]

Tags: , , , , , , ,

Kill only Tomcat

Posted by Ktoso under coding, java (No Respond)

There is sometimes the need to kill some JVM, I usually use “killall java” and that works fine as long as that’s in fact what I want – kill ALL. But let’s say i just want to kill Tomcat and not my IDE? The below method works quite well in such an situation: [ktoso@homunculus ~]$ [...]

Tags: , , , , , ,

(Almost) Automatically convert files into PDF

Posted by Ktoso under coding, freedom, fun, terminal heroes (No Respond)

I’m learning Numerical Analysis right now and a friend of mine found some really nice PS files by dr Marian Bubek ( http://www.icsr.agh.edu.pl/~mownit/mownit.html ). I was really happy to see some *.ps but some people from my fellow students started complaining that they’d rather have pdf’s and not ghostscript files (who knows why they’d do..?). [...]

Tags: , , , , , , , , , , , , , ,

AWK and multiple lines from shell command

Posted by Ktoso under coding (No Respond)

Let’s say you want to read the ps output inside an AWK script, it’s not so simple since system returns an exit code and not the string you want – it’s being sent to stdout, here is a simple trick to read multiple lines from a shell command inside awk: awk ‘BEGIN{while (“ps aux” | [...]

Tags: , , , , , , , ,

yum: TypeError: rpmdb open failed

Posted by Ktoso under coding (2 Responds)

I recently had this following fatal error on an CentOS VPS server: Loaded plugins: fastestmirror error: no dbpath has been set error: cannot open Packages database in /%{_dbpath} Traceback (most recent call last): File “/usr/bin/yum”, line 29, in ? yummain.user_main(sys.argv[1:], exit_code=True) File “/usr/share/yum-cli/yummain.py”, line 229, in user_main errcode = main(args) File “/usr/share/yum-cli/yummain.py”, line 84, in [...]

Tags: , , , , , , ,

Smart webpage migration

Posted by Ktoso under coding, freedom, guide (No Respond)

I recently had to migrate a big website – about 5GB – to a new server. That could take a while to do, right? Well, maybe if you did it like that (the not smart way): Thanks goodness I’m not really keen on doing stuff the slow “not_smart” way, and the new server is a [...]

Tags: , , , , , , ,