Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing crontab #542

Open
TheYellowArchitect opened this issue Nov 30, 2023 · 1 comment
Open

Missing crontab #542

TheYellowArchitect opened this issue Nov 30, 2023 · 1 comment

Comments

@TheYellowArchitect
Copy link

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
Copy link

emrakyz commented Dec 1, 2023

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants