A bash script implementation for automated daily Git commits, inspired by Daily-Git-Commit. All credit goes to the original author.
- Download the code or fork and clone the repository
- Update the paths in
bot.sh
:# Update these lines with your folder paths echo "$info" >> /home/your-user/Desktop/projects/daily-commit-bot/output.txt cd /home/your-user/Desktop/projects/daily-commit-bot/
- Choose your preferred configuration method below
-
Create required directories:
mkdir -p ~/.local/etc/cron.daily ~/.var/spool/anacron
-
Set up the script:
- Move the script to
~/.local/etc/cron.daily/
- Rename
bot.sh
tobot
(remove extension to avoid anacron issues):mv bot.sh bot
- Make the script executable:
sudo chmod +x bot
- Move the script to
-
Configure Anacron:
- Create anacrontab config file:
touch ~/.local/etc/anacrontab
- Add the following configuration (using your preferred editor):
Note: "daily.script" can be any identifier you prefer
SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin 1 0 daily.script run-parts /home/your-user/.local/etc/cron.daily/
- Create anacrontab config file:
-
Test the configuration:
# Verify setup (no output means no errors) anacron -T -t ~/.local/etc/anacrontab -S /home/your-user/.var/spool/anacron # Test execution anacron -fn -t /home/your-user/.local/etc/anacrontab -S /home/your-user/.var/spool/anacron
-
Final configuration:
anacron -t /home/your-user/.local/etc/anacrontab -S /home/your-user/.var/spool/anacron
-
Open crontab editor:
crontab -e
-
Add the following lines (example for commits at 16:00 and 21:00):
0 16 * * * /bin/bash /home/your-user/Desktop/projects/daily-commit-bot/bot.sh 0 21 * * * /bin/bash /home/your-user/Desktop/projects/daily-commit-bot/bot.sh