ist es möglich eine Liste aller Screens eines bestimmten Benutzers aufzurufen?
Hintergrund ist der, dass ich ein Script per Root starte, dass per sudo einen screen startet.
Nun will ich diesen per Script auch beenden oder den Status davon abrufen können, was nicht mit grep geht, da dies nur die screens von root lesen will :(
Quote, weil Farbtags sonst nicht funktionieren.
Vielen Dank für jeden Hint.# !/bin/bash
# Copyright (2009) by http://www.GoW-Clan.net
case "$1" in
start)
cd /home/game-server/callofduty4/mods/manuadminmod/
echo "================================================"
echo "The Call of Duty 4 ManuAdminMod is starting now."
if [[ `screen -ls |grep ManuAdminMod1` ]]; then
echo ">>> The Call of Duty 4 ManuAdminMod is already started!"
echo "================================================"
exit 1
else
sudo -u game-server screen -dmS ManuAdminMod1 php -f daemon.php "configs" "log-files"
fi
sleep 1
echo "------------------------------------------------"
sleep 1
echo "The Call of Duty 4 ManuAdminMod was started now."
echo "================================================"
;;
stop)
cd /home/game-server/callofduty4/mods/manuadminmod/
echo "================================================"
echo "The Call of Duty 4 ManuAdminMod is stopping now."
if [[ `screen -ls |grep ManuAdminMod1` ]]; then
sudo -u game-server kill `screen -ls |grep ManuAdminMod1 |awk -F . '{print $1}'|awk '{print $1}'`
else
echo ">>> The Call of Duty 4 ManuAdminMod is already stopped!"
echo "================================================"
exit 1
fi
sleep 1
echo "------------------------------------------------"
sleep 1
echo "The Call of Duty 4 ManuAdminMod was stopped now."
echo "================================================"
;;
restart)
cd /home/game-server/callofduty4/mods/manuadminmod/
echo "================================================"
echo "The Call of Duty 4 ManuAdminMod is stopping now."
if [[ `screen -ls |grep ManuAdminMod1` ]]; then
sudo -u game-server kill `screen -ls |grep ManuAdminMod1 |awk -F . '{print $1}'|awk '{print $1}'`
else
echo ">>> The Call of Duty 4 ManuAdminMod is already stopped!"
echo "================================================"
exit 1
fi
sleep 1
echo "------------------------------------------------"
sleep 1
echo "The Call of Duty 4 ManuAdminMod was stopped now."
echo "================================================"
echo ""
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo ""
echo "================================================"
echo "The Call of Duty 4 ManuAdminMod is starting now."
if [[ `screen -ls |grep ManuAdminMod1` ]]; then
echo ">>> The Call of Duty 4 ManuAdminMod is already started!"
echo "================================================"
exit 1
else
sudo -u game-server screen -dmS ManuAdminMod1 php -f daemon.php "configs" "log-files"
fi
sleep 1
echo "------------------------------------------------"
sleep 1
echo "The Call of Duty 4 ManuAdminMod was started now."
echo "================================================"
;;
status)
cd /home/game-server/callofduty4/mods/manuadminmod/
echo "================================================"
if [[ `screen -ls |grep ManuAdminMod1` ]]; then
echo ">>> The Call of Duty 4 ManuAdminMod is running!"
else
echo ">>> The Call of Duty 4 ManuAdminMod is stopped!"
fi
echo "================================================"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
exit 0