crontab tasks are accumilating
While checking the status of cron service, could see around 160 tasks are in queue, couldn't clear them by stopping and starting the cron service.
How to clear the queued cron task in ubuntu.
Thanks in advance.!
Question information
- Language:
- English Edit question
- Status:
- Needs information
- For:
- Ubuntu Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 14 hours ago
- Last reply:
- 4 hours ago
What is the output of:
ps -ef | grep cron; lsb_release -a; uname -a
Thanks
Manfred Hampl (m-hampl) said : | #3 |
What is the output of the commands
systemctl status cron
sudo ls -la /var/spool/
(You are free to obfuscate details that you want to keep secret, as long as the gist stays readable.)
Remark:
I am a bit astonished to see a quite old version of the kernel (4.4.0-31). Current version is 4.4.0-200
Thanks for the update, will look into kernel version.
Please find the details below,
root@bd-server1:~# ps -ef | grep cron; lsb_release -a; uname -a
root 4396 1 0 Jan06 ? 00:00:04 /usr/sbin/cron -f
root 19845 19829 0 12:20 pts/27 00:00:00 grep --color=auto cron
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
Linux bd-server1.com 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@bd-server1:~# systemctl status cron
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/
Active: active (running) since Wed 2021-01-06 00:34:08 IST; 1 weeks 6 days ago
Docs: man:cron(8)
Main PID: 4396 (cron)
Tasks: 167
Memory: 44.4M
CPU: 1h 53min 50.866s
CGroup: /system.
├─ 356 /bin/sh /home/oracle/
├─ 431 /bin/sh /home/oracle/
├─ 580 /bin/sh /home/oracle/
├─ 582 /bin/sh /home/oracle/
├─ 771 /bin/sh /home/oracle/
├─ 967 /bin/sh /home/oracle/
├─ 1200 /bin/sh /home/oracle/
├─ 1653 /bin/sh /home/oracle/
.
.
.
.
├─31552 /bin/sh /home/oracle/
├─31889 /bin/sh /home/oracle/
├─32577 /bin/sh /home/oracle/
└─32641 /bin/sh /home/oracle/
Jan 19 12:17:01 bd-server1.com CRON[19643]: (barman) CMD ([ -x /usr/bin/barman ] && /usr/bin/barman -q cron)
Jan 19 12:17:01 bd-server1.com CRON[19640]: pam_unix(
Jan 19 12:18:01 bd-server1.com CRON[19665]: pam_unix(
Jan 19 12:18:01 bd-server1.com CRON[19666]: (barman) CMD ([ -x /usr/bin/barman ] && /usr/bin/barman -q cron)
Jan 19 12:19:01 bd-server1.com CRON[19685]: pam_unix(
Jan 19 12:19:01 bd-server1.com CRON[19686]: (barman) CMD ([ -x /usr/bin/barman ] && /usr/bin/barman -q cron)
Jan 19 12:19:02 bd-server1.com CRON[19685]: pam_unix(
Jan 19 12:20:01 bd-server1.com CRON[19758]: pam_unix(
Jan 19 12:20:01 bd-server1.com CRON[19759]: (barman) CMD ([ -x /usr/bin/barman ] && /usr/bin/barman -q cron)
Jan 19 12:20:01 bd-server1.com CRON[19758]: pam_unix(
root@bd-server1:~# sudo ls -la /var/spool/
total 12
drwx-wx--T 2 root crontab 4096 Jan 6 00:36 .
drwxr-xr-x 5 root root 4096 Dec 24 2018 ..
-rw------- 1 oracle crontab 2727 Jan 6 00:36 oracle
Manfred Hampl (m-hampl) said : | #5 |
Are those backup jobs still running?
e.g. do you see them with
ps ax | grep "/bin/sh /home"
Eventually there is a problem with the backup jobs that keeps them running forever instead of ending.
for your question, yes.
Initially we stopped all schedules for couple of days. then after again enabled.
ps ax | grep "/bin/sh /home"
356 ? D 0:00 /bin/sh /home/oracle/
431 ? D 0:00 /bin/sh /home/oracle/
580 ? D 0:00 /bin/sh /home/oracle/
582 ? D 0:00 /bin/sh /home/oracle/
771 ? D 0:00 /bin/sh /home/oracle/
967 ? D 0:00 /bin/sh /home/oracle/
1200 ? D 0:00 /bin/sh /home/oracle/
yes, your are right. But same script is running fine in other machines.
Is there any way to clear all crontab tasks and restarting the cron service.
Stopping cron service and staring not clearing the Queue of TASKS.
Could kill the PIDs. I suggest you add lines to the script to echo text to a file on the system so that you can read it and see where it stops and hangs
Killing PIDs not worked.
Backups are running now without any issues. But couldn't clear the past cron TASK's queue.
Any other ways, I can get here.
Manfred Hampl (m-hampl) said : | #10 |
What happens if you issue the command
kill 356 431 580
or (if this gives a "not authorized")
sudo kill 356 431 580
or eventually
sudo kill -SIGHUP 356 431 580
etc.
Can you help with this problem?
Provide an answer of your own, or ask Saiprakash Muvva for more information if necessary.