An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
September 26, 2021 04:42 pm GMT
Original Link: https://dev.to/has12zen/using-cron-keep-your-eyes-in-check-k83
Using Cron keep your eyes in check
basic syntax for cron
a typical cron job looks like this
# m h dom mon dow command * * * * * /usr/bin/sh ls
- stand for wildcardthis is not a cron tutorial this is just how i use it.
eyes.sh script
the bash script looks like
#!/bin/shexport DISPLAY=:0notify-send "EYES CHECK" "Look away for 15 seconds"
without line no 2 it wont work as it sets the display for notify-send. I am using notify-send as my notification daemon.
make sure that your display is :0
you can do this with
echo $DISPLAY
setting up crontab
first you will need to make sure cron is running you can do this by:
systemctl status cronie
p.s. this is specific to arch based system.
once cron is running you can create/edit cron job with crontab -e
then paste the code present below into the window.
*/15 * * * * /usr/bin/sh /home/elnovo/.noti/eyes.sh
it runs every 15 min and eyes.sh is the bash script we discussed above. save it.
you can find the cron jobs currently present by crontab -l
sources
Original Link: https://dev.to/has12zen/using-cron-keep-your-eyes-in-check-k83
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To