I have a script for my P2Pool which I am not sure how to create or make. I am not really a *nix guy. I am using KDE so yes I know how to open KWrite and copy and paste the script into it, but I don't know were to save it or if I need to make any changes using chmod to the file?

I appreciate your help!

Example script:

###sample script

#!/bin/bash


NICE=`ps -eo pid,nice,command | grep '/home/btd/bitcoinroot/bin/bitcoind' | grep -v grep | awk '{ print $2 }'`
PID=`ps -eo pid,nice,command | grep '/home/btd/bitcoinroot/bin/bitcoind' | grep -v grep | awk '{ print $1 }'`

P2P_NICE=`ps -eo pid,nice,command | grep '/home/xo/p2pool/run_p2pool.py' | grep -v grep | awk '{ print $2 }'`
P2P_PID=`ps -eo pid,nice,command | grep '/home/xo/p2pool/run_p2pool.py' | grep -v grep | awk '{ print $1 }'`

if [ $NICE -ne -20 ] ; then

echo "$PID is not nice!"
echo "Setting $PID to -20 nice value..."
renice -n -20 -p $PID
ionice -c1 -p $PID

else

echo "$PID is already set to nice value $NICE"
fi

if [ $P2P_NICE -ne -20 ] ; then

echo "p2pool is not running with nice"
echo "Setting $P2P_PID to -20 nice value.."
renice -n -20 -p $P2P_PID
ionice -c1 -p $P2P_PID

else
echo "p2pool is already running with $P2P_NICE "
fi

##script ends

##change txqueuelen of network interface
ifconfig ens32 txqueuelen 2000