I accidentally deleted some upstart job conf (in /etc/init/). Unfortunately I didn't set any respawn limit, and those jobs are now unstoppable.

I searched online but didn't find any answers, hope I will have better luck here. Regards R

PS: I'm using ubuntu 12.04


Assuming you know what files you have deleted, you can:

  • restore them from a backup (you have backups, right?)
  • if you don't have a backup, you can locate the package that provides the file using either:

    # dpkg-query -S /path/to/file

    (if you still have the package installed; you should, you just deleted a file from it)

    # apt-file /path/to/file

    (if you don't have the packaged installed anymore, for whatever reason)

    You can also use the Ubuntu Packages Search web site.

  • Afterwards, when you know which package that file you deleted came from, you can just

    # aptitude reinstall package

    and the file will be there again and you will be able to stop your processes normaly.

| improve this answer | |
  • Thx for your answer but it was custom made upstart conf file. – rmonjo Apr 2 '14 at 8:31
  • So, you don't have any other copy of it, say, in a repository somewhere? – dawud Apr 2 '14 at 9:10
  • They are generated by a script, I generated them back, but now way to kill them: sudo stop my-job answers with my-job, start/running, process 32061 – rmonjo Apr 2 '14 at 9:27
  • What stops you from SIGKILL/SIGTERM them? – dawud Apr 2 '14 at 9:47
  • Well, they respawn :) But I actually figured it out. Restarting the job seems to reset to a coherent state. – rmonjo Apr 2 '14 at 9:59

I've tried to reproduce, and as long as the service is running, upstart will know how to stop it with stop $svcname. You can see if upstart knows about it with initctl list | grep $svcname. If upstart doesn't list it, then you should be able to kill it with kill. Make sure the service doesn't have its own watchdog/parent process, though, in which case you would have to kill that instead.

| improve this answer | |
  • 1
    Thx for your answer. I see my jobs in initctl list, but when I sudo stop myjob, it ends up telling me: my-job start/running, process 23213. – rmonjo Apr 2 '14 at 8:27

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.