Guest User

Untitled

a guest
Dec 13th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. = monitor.sh: reduce command output and protect against inactivity
  2.  
  3. == Purpose
  4.  
  5. This script is handy for situations that require output but is
  6. unable to handle too much output.
  7.  
  8. A catch-22 situation like on Travis CI:
  9.  
  10. * Travis terminates a job on over-logging: when output exceeds 4MB
  11. * Travis terminates a job on inactivity: when there has been no
  12. output for 10 minutes
  13.  
  14. While this is reasonable, in certain situations, such as when
  15. processing a lot of objects, the command used (e.g. `aws`) do not
  16. provide any viable alternative that can satisfy these two conditions
  17. at the same time.
  18.  
  19. So this script is useful in those situations.
  20.  
  21.  
  22. == Usage
  23.  
  24. [source,console]
  25. ----
  26. ./monitor.sh <my-command> [--with-arguments <values>]
  27. ----
  28.  
  29.  
  30. For example, this is how a site with over 40,000 objects gets
  31. uploaded to S3 (over 15 minutes) without getting terminated by
  32. Travis for inactivity or over-logging.
  33.  
  34. [source,console]
  35. ----
  36. ./monitor.sh aws s3 sync _site s3://$S3_BUCKET_NAME \
  37. --region=$AWS_REGION --delete --no-progress
  38. ----
  39.  
  40.  
  41.  
  42. == Mechanism
  43.  
  44. This script does the following:
  45.  
  46. . Spawns your specified command in the background.
  47. . Stores its PID and checks its existence every 1 second.
  48. . On every 10 seconds, it prints out a message indicating how long
  49. the command has been run.
  50. . When the command exits, it will print out a message indicating so.
  51. . Then the script exits.
  52.  
  53.  
  54. == License and copyright
  55.  
  56. This code is licensed under 2-clause BSD.
  57.  
  58. Copyright 2018 Ribose.
Add Comment
Please, Sign In to add comment