banana 476 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. # note: do not name this script "monkey"
  3. # pidof, killall does not work properly if monkey is in working dir
  4. cd /tmp
  5. if [ "$1" = "start" ]
  6. then
  7. "$0" stop
  8. chown -R nobody:nobody /root/monkey/
  9. /root/monkey/bin/monkey -Dc /root/monkey/conf
  10. exit
  11. fi
  12. if [ "$1" = "stop" ]
  13. then
  14. if pidof monkey > /dev/null
  15. then
  16. killall -q -2 monkey
  17. sleep 1
  18. killall -q -2 monkey && killall -q -9 monkey
  19. fi
  20. exit
  21. fi
  22. echo "Useage: `basename "$0"` [start|stop]"