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?

1 Answer 1


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
  • Your second cronjob is incorrect, it should be 58 6 * * *. The first field is minutes, and the second is hours.
    – Alaa Ali
    Jun 26, 2013 at 18:28
  • How can it be done as the task is running? (Killing a running cron process manually?)
    – mini
    Jun 26, 2013 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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