LukeSmithxyz / LARBS

Luke's Auto-Rice Bootstrapping Scripts: Installation Scripts for My Arch Linux Meta-Distribution
GNU General Public License v3.0
2.02k stars 797 forks source link

Missing crontab #542

Open TheYellowArchitect opened 7 months ago

TheYellowArchitect commented 7 months ago

Installed Artix (runit) then LARBS. There are scripts using crontab (e.g. /usr/local/bin/mw for commands like mw -t 10) but crontab outputs: zsh: command not found: crontab

The command sudo pacman -S crontab outputs: error: target not found: crontab

emrakyz commented 7 months ago

Cronjob manager is not a part of the default LARBS installation. Cronjob is also optional for Mutt-Wizard.

The command crontab is used by all cronjob managers such as cronie, anacron, dcron and all others. This is valid for all distros.

If you want the most minimalist and robust solution, you can install dcron. pacman -S dcron would do the job.

Then you can create cronjobs with it using crontab -e

That command will use your EDITOR and opens a text file for you. You will add cronjobs on each line.

If you are logged in as root user or if you want to automate this in an installation script: echo "*/30 * * * * $YOUR_SCRIPT" | crontab -u $YOUR_USERNAME -

That above command will create a cronjob for your specified script for your specified user and it will run that every 30 minutes.

For example I use this script for my mail notifications:

The first two lines are for getting the dbus key in order to run notify-send on Wayland as a cronjob. I guess you can delete it on X.

#!/bin/dash

PID=$(pgrep -u $LOGNAME $COMPOSITOR)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

mailsync

NEWMAILS=$(find ~/.local/share/mail/*/*/new -type f)

[ -z "$NEWMAILS" ] && exit

count=$(echo "$NEWMAILS" | wc -l)

notify-send -u critical "You have $count new e-mails."