1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/archivist_ynh.git synced 2024-09-03 18:15:55 +02:00
archivist_ynh/scripts/_common.sh

58 lines
2 KiB
Bash
Raw Normal View History

2017-11-01 20:57:58 +01:00
#!/bin/bash
#=================================================
2021-11-20 10:08:45 +01:00
# COMMON VARIABLES
2017-11-01 20:57:58 +01:00
#=================================================
2022-07-16 19:44:33 +02:00
#=================================================
# PERSONAL HELPERS
#=================================================
2020-05-02 00:51:36 +02:00
2024-03-29 12:47:49 +01:00
_set_frequencies() {
case "$frequency" in
daily)
frequency_cron="0 2 * * *"
frequency_human="every day"
;;
days_3)
frequency_cron="0 2 */3 * *"
frequency_human="each 3 days"
;;
weekly)
frequency_cron="0 2 * * 0"
frequency_human="once a week on sunday"
;;
weeks_2)
frequency_cron="0 2 * * 0/2"
frequency_human="one sunday out of two"
;;
monthly)
frequency_cron="0 2 1 * *"
frequency_human="once a month on the first sunday"
;;
*)
ynh_die --message="Unsupported frequency $frequency" ;;
esac
# For POST_INSTALL.md
ynh_app_setting_set --app="$app" --key=frequency_human --value="$frequency_human"
}
_fix_frequencies() {
case "$frequency" in
Daily) frequency="daily" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
"Each 3 days") frequency="days_3" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
"Weekly") frequency="weekly" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
"Biweekly") frequency="weeks_2" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
"Monthly") frequency="monthly" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
esac
}
2019-01-30 19:56:49 +01:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
2018-03-14 23:20:44 +01:00
#=================================================
2024-03-29 12:47:49 +01:00
# FUTURE OFFICIAL HELPERS
2019-01-13 17:19:46 +01:00
#=================================================