MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.149.232.87
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0555) :  /usr/bin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/bin/libcare-cron
#!/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."

MMCT - 2023