Cronie

Basic Command

Install (arch/endeavour)

sudo pacman -S crounie

Service start, status, restart, stop

sudo systemctl start cronie

sudo systemctl status cronie

sudo systemctl restart cronie

sudo systemctl stop cronie

Service enable or disable on startup

sudo systemctl enable cronie

sudo systemctl disable cronie

Display the contents of the crontab file of the currently logged in user

crontab -l

Edit the current user's cron jobs

crontab -e

Add Task

Create example file

mkdir ~/.local/bin

nano cronie-example
#!/usr/bin/env sh

croniedir=/home/spot/spotspace/cronie-example

cd $croniedir

git pull github master -q

result=$(git status --porcelain | wc -l)

if [[ $result -eq 0 ]] ; then
        exit 0

fi
        git add .; git commit -q -m "$(date +"%c")"; git push github master -q

Put to crontab

crontab -e
@reboot /bin/sleep 120 ; /home/spot/.local/bin/cronie-example

Note

In ubuntu cron is installed by default. but cron is deferent with cronie.


Reference

Last updated