Sh3ll



Directory :  /scripts2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : //scripts2/imunify_scan.sh
#!/bin/bash
# Launch an ImunifyAV scan process.

TARGET=$1

if ! [ "$TARGET" ]; then
  echo "You must provide a directory."
  exit 1
fi

if ! [ -d "$TARGET" ]; then
  echo "Directory \"$TARGET\" does not exist."
  exit 2
fi

LOAD=$(imunify-antivirus malware on-demand status --json)

STATE=$(echo $LOAD | jq -r .items.status)

if [ "$STATE" == "stopped" ]; then
  imunify-antivirus malware on-demand start --path $TARGET
else
  cur=$(echo $LOAD | jq -r .items.path)
  strt=$(echo $LOAD | jq -r .items.started)
  echo "Scan already running in $(realpath $cur) -- since $(date -d @$strt)."
fi

Sh3LL