What commands can I use in Terminal to see pending or scheduled tasks for today or tomorrow.
For example how can I detect pending system shutdown?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
There is util called
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
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 -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