2020/04/30

bash script to kill a process based on partial name

why you might need this: because sometimes some processes can't simply terminated using the GUI. And after too many years typing ps -A | grep something then kill -9 the id, I decided to write a script to avoid having to type two commands.

Be warned, this will only kill the first process found with the lowest process ID.

it takes only one argument as the partial name to be looked upon the ps -A command.
#!/bin/bash
proc=$(ps -A |grep $1 | head -n 1)
if [ -z "$proc" ] ; then
   echo Error: no processes found with the given partial name!
   exit 1
fi
echo ps -A says:
echo $proc
procid=$( echo "$proc" |grep "[0-9]*" -o |head -n 1)

echo "kill? <Y/N>"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
    echo Yes
    kill -9 $procid
    echo Testing if the process is still alive ...
    isdead=$(ps -A |grep "$proc")
    [ -z "$isdead" ] && echo Process has been terminated! || echo process is still alive !?
else
    echo No!
fi
you can replace the question with the actual command but I don't recommend it.

2020/04/08

Installing multilib on slackware-current

this is not really big a problem (except if you consider the time one may waste)

today I made a fresh install of slackware-current on a notebook. Since I wanted to install wine to run some specific wine programs, I went to google typed "slackware multilib". I have done this process several times over the years. So, just as before, I reached this page http://www.slackware.com/~alien/multilib/ which I use as a cheatsheet each time I want to install multilib.

the problem arises because its my first time using -current and also because I copied/pasted the commands mentioned in the "Enabling multilib" first four points without reading the next section. As a consequence I ended up with a broken installation. At first I thought I have installed the 32 bits version, but later I realized there's also a "current" directory on the ftp site.

two things that may add up to the confusion: the fact that Slackware-current says "Slackware 15" at the lilo screen and the /etc/slackware-version file says "slackware 14.2"

so the four commands should be:


Quote:
lftp -c 'open http://slackware.com/~alien/multilib/ ; mirror -c -e current'
cd current
upgradepkg --reinstall --install-new *.t?z
upgradepkg --install-new slackware64-compat32/*-compat32/*.t?z

2020/04/02

Installing Waterfox addons (the "hard" way)

Apparently the guys at Mozilla have found/left a hole somewhere on Waterfox browsers engine (since its also from Mozilla but modified) to reveal the real user agent to websites.

(Note to self: check where is it and how to counter it)

Specific case is addons.mozilla.org: even if you have an user agent spoofer and you choose whatever Firefox version, it will not let download the addon you want.

So the trick is to have an old copy of firefox installed and use it to open the addon page you want. Then simply copy the link to install it, paste into Waterfox and remove the last part of the url so it ends with the xpi extension.