Skip to content

Instantly share code, notes, and snippets.

@zevolution
Last active March 16, 2021 11:04
Show Gist options
  • Save zevolution/2a9448fdfc08fe3738708f76aa1a4e13 to your computer and use it in GitHub Desktop.
Save zevolution/2a9448fdfc08fe3738708f76aa1a4e13 to your computer and use it in GitHub Desktop.
Shell script to punch the clock in Ahgora Application

Ahgora Punch The Clock

Add environment variables in ~/.profile.

export AHGORA_ACCOUNT=
export AHGORA_PASSWORD=
export AHGORA_IDENTITY=

Create .sh (remember to give permission for execution with chmod +x bater-ponto.sh)

#!/usr/bin/env bash
cd /home/user/scripts/ahgora
sleep $(((RANDOM % 50) + 1)) \
  && curl --request POST \
  --url https://www.ahgora.com.br/batidaonline/verifyIdentification \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data account=${AHGORA_ACCOUNT} \
  --data password=${AHGORA_PASSWORD} \
  --data identity=${AHGORA_IDENTITY} \
  --data origin=pw2 \
  --data key= \
  -w "\n" \
  -s \
  | sed -e "s/^/$(date -R) /" >> log.txt

Create CronJob with crontab -e

0 8 * * 1-5 . $HOME/.profile; /home/user/scripts/ahgora/bater-ponto.sh
0 12 * * 1-5 . $HOME/.profile; /home/user/scripts/ahgora/bater-ponto.sh
15 13 * * 1-5 . $HOME/.profile; /home/user/scripts/ahgora/bater-ponto.sh
15 17 * * 1-5 . $HOME/.profile; /home/user/scripts/ahgora/bater-ponto.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment