📜 ⬆️ ⬇️

Check 25 minutes!

How often do you just need to check the time? I think that such a need periodically arises for all. Someone just looks at the clock, someone uses special programs, someone sets the alarm on the phone.

But besides all these methods, you can still do this:

sleep 25m ; xmessage 'Hey! :)' 

Only two teams that are quite easily remembered.
')
Instead of xmessage, there could of course be anything else. For example:

 sleep 8h 30m ; mplayer /home/user/Music/pink_floyd-the_happiest_days_of_our_lives.flac 

However, here we must bear in mind that the command will not be executed if you close the terminal. If it is necessary for the team to complete, then there are several ways to do it.

For example, such:

 nohup sh -c "sleep 5s ; xmessage ':)'" & 

Or, alternatively, such (just remember to first execute /etc/init.d/atd status and check if atd is running):

 echo "DISPLAY=:0 xmessage ':)'" | at now + 1 minute 

At at all an interesting syntax - there are quite a few different ways to set the desired time for the task. You can still like this, for example:

 echo "DISPLAY=:0 xmessage ':)'" | at 14:25 

Well, the environment variable DISPLAY is also very widely used. It allows you to set a specific X-display, so that the graphic program was shown on it. Therefore, if you, for example, connected to the computer via SSH and want to display a message on the screen (so that the user who is sitting at the computer sees it), then this is done in the same way:

 DISPLAY=:0 xmessage ':)' 

And exactly the same situation with many more things - you need to look at the documentation once, and then use as many as you like in a wide variety of combinations, without installing specialized utilities.

I hope for someone this article was useful. If there are any questions on this topic - write.

Source: https://habr.com/ru/post/144638/


All Articles