0

I created an at job that executes a script with the -f flag. The script restarts tomcat. The job was scheduled to be executed at Feb 21 18:00:00 2022 which was yesterday. I just confirmed tomcat was restarted at that time. However when I execute atq today, I get:

3   Mon Feb 21 18:00:00 2022 = alexander

My understanding is that atq only lists pending jobs. Why is my job from yesterday being listed?

Update:

I just reviewed my script and it contains tail which never exits at the end. That is probably causing the job to take forever to quit. I found the output at /var/spool/at/spool/a0000301a27604. But the file was last modified at 2022-02-21 23:40:33.534191768. I just found out that's where the last output to tail arrived at. How do I get the process number of the still running task?

2
  • 1
    "But the file was last modified at 2022-02-21 23:40:33.534191768, which means, at aborted the job" - not necessarily. It just means that the file was last written at that time. Your job could be still running (and possibly still is) but just not writing anything Feb 22, 2022 at 11:14
  • @roaima you're right. I confirmed that was not the case. That was the time catalina started to writing to another log file. I have edited my question. Thanks
    – Alex
    Feb 22, 2022 at 11:19

1 Answer 1

2

For the latest version of your question, "How do I get the process number of the still running task?"

pgrep atd
525

pstree -p 525
atd(525)───atd(6729)───sh(6738)───sleep(6739)

Or, rolling the two commands together safely

pgrep atd | xargs -n1 -r pstree -p
2
  • Thanks! BTW pgrep returned two pids for me so chaining the commands might not work the way you did it.
    – Alex
    Feb 22, 2022 at 13:14
  • @Alex thank you. I've adjusted the suggested command to handle multiple PIDs Feb 22, 2022 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .