As an anonymous user, you can only add new data. If you would like to also modify existing data, please create an account and indicate your languages on your user page.

User:MartinMai/fix mysql

From OmegaWiki
Jump to: navigation, search
#!/bin/bash
###########################################################

path="/root/skripte"
mkdir $path 2> /dev/null

filestdout=$path"/stdout"
filestderr=$path"/stderr"

date >> $filestdout

temp_storage="$tmp_path"/"$$"
touch $temp_storage

ps -C mysqld -o pid= 2>>$filestderr \
| sort --numeric --reverse 2>>$filestderr \
| tail -n 1 1> $temp_storage 2>>$filestderr

cat $temp_storage

temp_storage=$(<$temp_storage); rm -v $temp_storage

kill -8 $temp_storage 2>>$filestderr

stdout=$(<$filestdout); #rm $filestdout
stderr=$(<$filestderr); #rm $filestderr


logger -p warn "$stderr"

logger  "$stdout"
logger  "$stderr"