2
0

_common.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. #=================================================
  3. # COMMON VARIABLES
  4. #=================================================
  5. #=================================================
  6. # PERSONAL HELPERS
  7. #=================================================
  8. _set_frequencies() {
  9. case "$frequency" in
  10. daily)
  11. frequency_cron="0 2 * * *"
  12. frequency_human="every day"
  13. ;;
  14. days_3)
  15. frequency_cron="0 2 */3 * *"
  16. frequency_human="each 3 days"
  17. ;;
  18. weekly)
  19. frequency_cron="0 2 * * 0"
  20. frequency_human="once a week on sunday"
  21. ;;
  22. weeks_2)
  23. frequency_cron="0 2 * * 0/2"
  24. frequency_human="one sunday out of two"
  25. ;;
  26. monthly)
  27. frequency_cron="0 2 1 * *"
  28. frequency_human="once a month on the first sunday"
  29. ;;
  30. *)
  31. ynh_die --message="Unsupported frequency $frequency" ;;
  32. esac
  33. # For POST_INSTALL.md
  34. ynh_app_setting_set --app="$app" --key=frequency_human --value="$frequency_human"
  35. }
  36. #=================================================
  37. # EXPERIMENTAL HELPERS
  38. #=================================================
  39. #=================================================
  40. # FUTURE OFFICIAL HELPERS
  41. #=================================================