Guest User

Untitled

a guest
Dec 11th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Configuration files
  4. config='config.cfg'
  5. source "$config"
  6.  
  7. # If this is true, run the rest of the script in a new screen.
  8. # $background_logging comes from the configuration file declared above (config).
  9. if [ $background_logging == "true" ]; then
  10. exec screen -dmS "alt-logging" /bin/bash "$0";
  11. fi
  12.  
  13. [ $# -eq 0 ] && { echo -e "nERROR: You must specify an alt file!"; exit 1; }
  14.  
  15. # Logging script
  16. y=0
  17. while IFS='' read -r line || [[ -n "$line" ]]; do
  18. name="alt$y"
  19. echo -e "Starting alt number $y..."
  20. cmd="screen -dmS $name bash -c 'exec $line;'"
  21. eval $cmd
  22. echo -e "Successfully started alt number $y."
  23. echo -e "Waiting $logging_speed seconds..."
  24. sleep $logging_speed
  25. y=$(( $y + 1 ))
  26. done < "$1"
Add Comment
Please, Sign In to add comment