Ubuntu uses crontab to set timer shutdown and reminders

Source: Internet
Author: User
It's getting more and more serious all the time because of sitting in front of the computer. In order to remind yourself to rest in time, recommend that you use the Crontab Plan task to set up a timed shutdown Ubuntu, as well as the notify-send in a few minutes before the shutdown Timer bubble reminder is about to shut down.


First confirm that Ubuntu has installed and run Crond:


harry@ubuntu:~$ sudo service cron status
Cron start/running, Process 923


We will use Notify-send to send bubbling pop-up prompts to confirm that the installation is:


harry@ubuntu:~$ Notify-send–help


None to install:


harry@ubuntu:~$ sudo apt-get install Libnotify-bin


Then set the cron scheduled task:


harry@ubuntu:~$ sudo crontab-e


When you select an editor, enter:


* * * */sbin/shutdown-h 23:55


* * * Export display=:0.0;su–harry-c "Notify-send-i/usr/share/icons/humanity/emblems/48/emblem-danger.svg, the sky has been Late "It's time to wash and sleep!!" Automatic shutdown in 5 minutes.
* * * * export display=:0.0;su–harry-c "Notify-send-i/usr/share/icons/humanity/emblems/48/emblem-danger.svg, the sky has been Late "It's time to wash and sleep!!" Automatic shutdown in 2 minutes.


Change Harry's username to its own, display specifies the output terminal device, and the bubbling pop-up reminder background icon can be set itself. Reboot Crond after Setup:


sudo service cron restart


PS: If there is an urgent need to cancel the automatic shutdown: sudo shutdown-c. There is also a simple and useful small software gnome-typing-monitor, which can be set on a timer-locked computer screen, reminding you to take a break to work again, set below (Ubuntu 11.04):


The System settings-> hardware-> keyboard-> Typing break Check the lock screen to enforce Typing, setting the lockout interval and duration.


Reprint: http://farlee.info/archives/ubuntu-crontab-set-notice-shutdown.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.