How to set a timer? [Solved]

Forum rules
Before you post please read how to get help
Post Reply
AbhijitKumarSingh
Level 1
Level 1
Posts: 15
Joined: Fri Feb 12, 2021 7:02 am

How to set a timer? [Solved]

Post by AbhijitKumarSingh »

I need to set a timer using the terminal, is there a way?
Last edited by AbhijitKumarSingh on Tue Feb 23, 2021 7:54 am, edited 1 time in total.
1000
Level 4
Level 4
Posts: 316
Joined: Wed Jul 29, 2020 2:14 am

Re: How to set a timer?

Post by 1000 »

Which timer?
freshminted
Level 2
Level 2
Posts: 83
Joined: Fri May 01, 2020 12:26 am

Re: How to set a timer?

Post by freshminted »

Try the "at" command? You may have to install it first.
User avatar
AndyMH
Level 15
Level 15
Posts: 5898
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to set a timer?

Post by AndyMH »

Do you mean a cron job?
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate
AbhijitKumarSingh
Level 1
Level 1
Posts: 15
Joined: Fri Feb 12, 2021 7:02 am

Re: How to set a timer?

Post by AbhijitKumarSingh »

I am totally a noob, so I just want linux to remind me after say, 10 mins
User avatar
Welcome
Level 5
Level 5
Posts: 940
Joined: Wed Aug 19, 2020 11:38 am

Re: How to set a timer?

Post by Welcome »

You can use the sleep command. It uses seconds, so 10 minutes would be 600 seconds.

You can get fancy and add a sound or other notification.

Code: Select all

sleep 600 && paplay --volume 60000 /usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga
Last edited by Welcome on Mon Feb 22, 2021 9:57 am, edited 1 time in total.
3 steps to find an answer: (1) Search forum with unique key words. (2) Search with Google and add site:linuxmint.com to your unique key word query. (3) Search with Google and add either Linux Mint or Ubuntu to your unique key word query.
t42
Level 5
Level 5
Posts: 597
Joined: Mon Jan 20, 2014 6:48 pm

Re: How to set a timer?

Post by t42 »

I just want linux to remind me after say, 10 mins
You can install Gnome Clocks from the software manager or simply open terminal and paste this command

Code: Select all

sudo apt install gnome-clocks
14-57-30.png
-=t42=-
User avatar
Welcome
Level 5
Level 5
Posts: 940
Joined: Wed Aug 19, 2020 11:38 am

Re: How to set a timer?

Post by Welcome »

t42 wrote:
Mon Feb 22, 2021 9:55 am
...
You can install Gnome Clocks from the software manager or simply open terminal and paste this command
...
Since this thread is in "Scripts & Bash", maybe OP is looking for a command line solution. :wink: OP did originally say...
I need to set a timer using the terminal, is there a way?
3 steps to find an answer: (1) Search forum with unique key words. (2) Search with Google and add site:linuxmint.com to your unique key word query. (3) Search with Google and add either Linux Mint or Ubuntu to your unique key word query.
t42
Level 5
Level 5
Posts: 597
Joined: Mon Jan 20, 2014 6:48 pm

Re: How to set a timer?

Post by t42 »

Welcome wrote:
Mon Feb 22, 2021 10:07 am

Since this thread is in "Scripts & Bash", maybe OP is looking for a command line solution. :wink..
Of course, thanks :)
-=t42=-
User avatar
Welcome
Level 5
Level 5
Posts: 940
Joined: Wed Aug 19, 2020 11:38 am

Re: How to set a timer?

Post by Welcome »

This maybe a little complex, and doesn't include any error handling, but if you need a notification at a specific date and time, and must use a one-line bash command:

Code: Select all

sleep $(( $( date --date="27 Feb 2021 09:35:00" +%s ) - $( date +%s ) )) && paplay --volume 60000 /usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga
You'd need to adjust the date and time in the command, of course.
3 steps to find an answer: (1) Search forum with unique key words. (2) Search with Google and add site:linuxmint.com to your unique key word query. (3) Search with Google and add either Linux Mint or Ubuntu to your unique key word query.
freshminted
Level 2
Level 2
Posts: 83
Joined: Fri May 01, 2020 12:26 am

Re: How to set a timer?

Post by freshminted »

t42 wrote:
Mon Feb 22, 2021 9:55 am
You can install Gnome Clocks from the software manager or simply open terminal and paste this command

Code: Select all

sudo apt install gnome-clocks

14-57-30.png
This actually looked useful, so I installed it using

Code: Select all

sudo apt install gnome-clocks
. But I got a version without all the timer presets and looks like it's pretty ancient, version 3.28. What version are you running?
t42
Level 5
Level 5
Posts: 597
Joined: Mon Jan 20, 2014 6:48 pm

Re: How to set a timer?

Post by t42 »

freshminted wrote:
Mon Feb 22, 2021 10:37 pm
But I got a version without all the timer presets and looks like it's pretty ancient, version 3.28. What version are you running?
It's version 3.36.2 from LM 20.1 . In fact, I like the old version more, it was simple just enough.
-=t42=-
AbhijitKumarSingh
Level 1
Level 1
Posts: 15
Joined: Fri Feb 12, 2021 7:02 am

Re: How to set a timer?

Post by AbhijitKumarSingh »

I needed a bash script which I can change anytime so thanks.
1000
Level 4
Level 4
Posts: 316
Joined: Wed Jul 29, 2020 2:14 am

Re: How to set a timer? [Solved]

Post by 1000 »

Read about:
Cron
Anacron
Systemd timers

Maybe then you will know which one you want to use.
and maybe then you will have more questions.

Because we know too little about your project.
1000
Level 4
Level 4
Posts: 316
Joined: Wed Jul 29, 2020 2:14 am

Re: How to set a timer? [Solved]

Post by 1000 »

Read also about
1. What is the difference between & and &&
2. About sleep command
Post Reply

Return to “Scripts & Bash”