A php based tool to aid in clocking in and out automatically.
Features:
- Selenium webdriver based commands.
- Run as a cron job to clock in or out.
- Skips holidays.
- Customizable PTO/ Paid Time Off array to skip defined dates.
- Randomizes time period (within a range) that you clock in or out.
- Output can be saved as a back up of the punches, output is delimited by double quotes (") and field separated by commas (,) ie, csv format
Requires:
- Composer, for install instructions: https://getcomposer.org/download
- Chrome Browser: Version match required when installing ChromeDriver. Most recent version recommended
- ChromeDriver - get package here https://chromedriver.chromium.org/downloads get the version that corresponds to your chrome version.
- unzip chromedriver_linux64.zip
- sudo mv -f chromedriver /usr/local/share/chromedriver
- sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
- Php
- Php-Webdriver via Composer
composer install --no-dev
Usage:
- Install requred packages
- Copy
config.example.php
toconfig.php
- Set credentials and element ids in config file. (Requires walking through your clock in/out site and recording the proper css ids)
- Set a cron to run the program at your desired time for clocking in,
crontab -e
# 8:55 am Monday - Friday, script default is a 5 minute range from this time
55 8 * * 1-5 php /path/to/punch.php 'in' >> /path/to/time_sheet.txt
- Set a cron to run the program at your desired time for clocking out,
crontab -e
# 5:00 pm Monday - Friday, script default is a 5 minute range from this time
00 17 * * 1-5 php /path/to/punch.php 'out' >> /path/to/time_sheet.txt
- You can even create a desktop button to run the clock in sequence immediately (tested on ubuntu 18) with a .desktop file. Create a new file and add the following:
[Desktop Entry]
Comment=Clock In and log in time sheet
Icon=alarm-clock
Exec=sh -c "php /home/username/php-punch/punch.php 'in' 0 >> /home/username/Desktop/timesheet.txt"
Terminal=false
Type=Application
Name[en_US]=ClockIn
- To clock out create a new desktop file and add the following:
[Desktop Entry]
Comment=Clock Out and log in time sheet
Icon=alarm-clock
Exec=sh -c "php /home/username/php-punch/punch.php 'out' 0 >> /home/username/Desktop/timesheet.txt"
Terminal=false
Type=Application
Name[en_US]=ClockOut