0,0 → 1,45 |
#! /bin/bash |
|
TEMPFILE=/tmp/screenlets.running.${USER}.tmp |
|
if [ "${1}" = "stop" ]; then |
#Wrtie all curently running screnlets to temp file excluding screenlets deamon and manager |
|
ps aux | grep ${USER} | grep python | grep screenlets | sed '/screenlets-daemon.py/d; /screenlets-manager.py/d' | \ |
awk '{printf $2","; n=10;while(++n<NF) printf $n " "; printf "%s\n",$NF}'> ${TEMPFILE} |
|
#Read all file lines and close all running screenlets |
|
echo "I'm closing all running screenlets" |
while read line |
do |
PID=$(echo $line | awk -F, '{print $1}') |
kill -9 $PID |
done < ${TEMPFILE} |
|
elif [ "${1}" = "start" ]; then |
#Check if the temporary file exists |
|
if (test -r ${TEMPFILE}) then |
|
#Read the temporary file and lunch screenlets using their lunching cammand |
|
echo "Starting screelets using a temporary list file" |
while read line |
do |
COMMAND=$(echo $line | awk -F, '{print $2}') |
$COMMAND &> /dev/null & |
sleep 10 |
done < ${TEMPFILE} |
|
#Removing the temporary file |
|
rm ${TEMPFILE} |
|
else |
echo "Seems there is no temp file or you have no rights to access it" |
fi |
else |
echo "Usage ./screnlets-restart.sh start | stop" |
fi |
|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |