listlog.sh 417 B

1234567891011121314151617181920212223242526
  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 1
  7. fi
  8. if [ ! -f "$MAINLOG" ]; then
  9. echo "Maintenance Logfile not found: $MAINLOG"
  10. exit 1
  11. fi
  12. function getmaintenance {
  13. COUNT=1
  14. while read line; do
  15. NAME=$line;
  16. echo "$COUNT $NAME"
  17. COUNT=$((COUNT+1))
  18. done < $MAINLOG
  19. }
  20. getmaintenance
  21. exit 0