What commands show pending/scheduled tasks in Terminal?
There is util called cron
. Usually cron
handle task scheduling in Linux. But there is also few another ways to do it.
In case of cron
, you can just run crontab -l
to see all task scheduled by current user.
If you want to check task for another user use -u $username
key
TO check root
user tasks: sudo crontab -u root -l
To understand crontab format please read wiki
If you want to detect exactly system shutdown
The one of possible solutions is to wrap shutdown
command in a script.
Another solution is to write a trap
detecting SIGTERM signal, but this solution do not give you time when system will start halting. Read about trap here
Also there is another one tricky solution:
If you run sudo shutdown -r 20:00
, you spawn a process that will start shutdown at 20:00.
You can find this process using ps
$ ps -ef | grep shutdown
root 32222 32032 0 15:55 pts/8 00:00:00 sudo shutdown -r 20:00
root 32223 32222 0 15:55 pts/8 00:00:00 shutdown -r 20:00
c0rp 32382 32233 0 15:55 pts/10 00:00:00 grep --color=auto shutdown
And you can see a time here. If you kill this process, shutdown will be canceled
Related videos on Youtube
![B Best](https://i.stack.imgur.com/iPtl5.jpg?s=256&g=1)
B Best
Updated on September 18, 2022Comments
-
B Best almost 2 years
I'm currently trying to receive the
DateTime
from aXamarin.Forms.TimePicker
. I just want to populate the model which is aDateTime pickerTime
variable. This variable will be populated by whatever is in the TimePicker view.Therefore I need to do OneWayToSource data binding but I only ever find examples in XAML, where as I'm working in C# file because its an Android custom render of a abstract Xamarin.Forms Page.
Is there any way to OneWayToSource data bind in C#? If not I would try making the Forms View page type of my abstract sub-classed page so I have access to a XAML page and make the TimePicker view as well the data bound object in there that the Custom Renderer Pages inherit with OneWayToSource data binding.
Thanks for your help!
-
JoKeR about 10 yearsthanks for the link to wiki documentation its helpful but for example I just run
sudo shutdown -r 20:00
for example and when I run any of your suggested commands it saysno crontab for root
so my question is how can I list command like that in case I forgot about that it was supposed to restart at 20:00 or any other hour. -
JoKeR about 10 yearsThank you!
ps
works just great :-) -
B Best about 7 yearsLooking online it seems that the TimeProperty is of type
TimeSpan
. Is there a way to get this toDateTime
type? -
B Best about 7 yearsOr rather will using the Ticks operation on the
TimeSpan
give me the time in milliseconds as along
since that is what I need in the end. -
TaiT's about 7 years@BBest If you need the date and time, just go for a
DateTimePicker
control. It's easy to adapt this piece of code with your suitable control. -
B Best about 7 yearsIt's for gettin the time for an alarm so is it even necessary to get the date?
-
TaiT's about 7 yearsIt really depends on your business needs. I.e. If a future implementation needs the ability to set up an alarm the following day/week/month instead of the current day. It's up to you!
-
B Best about 7 yearsAhh good point, probably useful for repeating alarms on certain days