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