#!/bin/bash # Pour envoyer une instructions à tous les bots en même temps bots=('basile' 'deconnaisseur' 'hung' 'historien' 'salesman' 'saturnin' 'themis' 'parrot') # 'ibot') cmd=$1 case $cmd in kill) echo "Warning, killing all processes of users : ${bots[*]}" for bot in ${bots[*]} do sudo pkill -u $bot done ;; start|stop|restart|reload) for bot in ${bots[*]} do sudo service $bot $cmd done ;; status) for bot in ${bots[*]} do service $bot $cmd done ;; update|pull|maj) for bot in ${bots[*]} do cd /home/$bot/$bot sudo -u $bot git pull done ;; list|who) echo "Liste des bots : ${bots[*]}" ;; *) echo "Usage: all_bots {kill|start|stop|reload|restart|update|status}" ;; esac