diff --git a/dsmon.sh b/dsmon.sh index 3d210f8..731dd41 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -308,12 +308,15 @@ GETCRONTABS(){ ssh -tq root@${host_ip[$hostid]} apt install -yq sshpass > /dev/null 2>&1 fi echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs${idsCL[Default]}${idsST[Reset]}" - ssh -tq root@${host_ip[$hostid]} crontab -l | sshpass -p${rtpsswd} ssh -o 'StrictHostKeyChecking no' root@10.10.10.50 'cat > /opt/idssys/nodemgmt/crontabs/`hostname`.crontab' + ssh -tq root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} else echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}" fi done } +GETCRONTAB(){ + crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' root@10.10.10.50 'cat > /opt/idssys/nodemgmt/crontabs/`hostname`.crontab' +} SENDNOTICE(){ [ "${PUSHOVER_APP_TOKEN}" != "" ] && PUSH_TO_MOBILE "${2} @@ -328,6 +331,7 @@ case $action in check) CHECK ${2};; setupssh) SETUPSSH;; get-crontabs) GETCRONTABS;; + get-crontab) GETCRONTAB ${2};; run) RUN ${2};; runcmd) RUNCMD ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11};; update);;