Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to start the ubuntu update at night because internet is free at that time. and then kill the process in order to ensure that it does not download anything after 7:00 AM.

Is there any way to know the process ID of the cron job in order to kill it before the process run? Or any other way?

share|improve this question
up vote 2 down vote accepted

if you are just doing an apt-get update, apt-get upgrade, you can do this

sudo crontab -e
1 0 * * * apt-get update;apt-get -y upgrade
6 58 * * * pkill -9 apt-get
share|improve this answer
Your second cronjob is incorrect, it should be 58 6 * * *. The first field is minutes, and the second is hours. – Alaa Ali Jun 26 '13 at 18:28
How can it be done as the task is running? (Killing a running cron process manually?) – mini Jun 26 '13 at 19:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.