Server : Apache System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : andertr9 ( 1047) PHP Version : 8.2.18 Disable Function : NONE Directory : /usr/bin/ |
Upload File : |
#!/usr/bin/env bash # vi:syntax=sh set -eo pipefail progname=$(basename "$0") sub_help(){ echo "Usage: $progname <subcommand> [options]\n" echo "Subcommands:" echo " init" echo " disable" echo "" echo "For help with each subcommand run:" echo "$progname <subcommand> -h|--help" echo "" } LIBCARE_CRONFILE=/etc/cron.d/libcare-cron subcommand=$1 sub_disable(){ if [[ -e ${LIBCARE_CRONFILE} && -s ${LIBCARE_CRONFILE} ]]; then rm ${LIBCARE_CRONFILE} fi } sub_init(){ if ! [[ -e ${LIBCARE_CRONFILE} && -s ${LIBCARE_CRONFILE} ]]; then echo "$(( RANDOM % 60 )) */4 * * * root /usr/bin/kcarectl -q --lib-auto-update" > ${LIBCARE_CRONFILE} fi } case $subcommand in "" | "-h" | "--help") sub_help ;; *) shift sub_${subcommand} $@ if [ $? = 127 ]; then echo "Error: '$subcommand' is not a known subcommand." >&2 echo " Run '$progname --help' for a list of known subcommands." >&2 exit 1 fi ;; esac echo "Done."