addlog.sh 435 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. MAINLOG="/root/.maintenance"
  3. ## don't start as root
  4. if [ $(whoami) != root ]; then
  5. echo "run as root only"
  6. exit 0
  7. fi
  8. if [ ! -f "$MAINLOG" ]; then
  9. echo "Maintenance Logfile not found: $MAINLOG"
  10. exit 0
  11. fi
  12. E_NOARGS=65
  13. if [ -z "$1" ]
  14. then
  15. echo "Usage: "
  16. echo " ./$(basename $0) \"added new guest account\" "
  17. echo
  18. exit $E_NOARGS
  19. fi
  20. mydate=$(date +"%b %d %H:%M:%S")
  21. echo $mydate $1 >> $MAINLOG
  22. exit 0