Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So there is a process I see in my activity monitor and I can kill it. Due to whatever, another process is set to restart the killed process every 8 hours and it can not be changed. I am looking for a macro of sorts to have the killable process killed every 8 hours. Mmmm?

share|improve this question

1 Answer 1

Are you able to manually kill the process using the kill command in terminal?

I've setup the scheduler to kill user jobs that run out of control by noting the program name and the time it's been running and how much cpu it's eating up. I usually get that by running the 'ps' command and piping it to awk because it can do the if/then/elses needed to see if the process is truly the troublemaker and needs killing.

In your case, if it's always a single program that needs killing, you can simply schedule the following command every 8 hours via cron:

8 7,15,23 * * * killall "program-name-to-kill-here" >/dev/null 2>&1

Translation: at 8 minutes past 7am, 3pm and 11pm everyday kill the program between double-quotes" and send the feedback to nowhere...

You can read the man page for crontab from terminal using: man crontab

share|improve this answer
    
Every 8 hours would be 0 */8 * * * killall processname > /dev/null 2>&1. And if the process is owned by root, you can use sudo crontab -e. –  ؘؘؘؘ Jan 31 '13 at 10:32
    
every 8 hours can be defined in both ways –  hvtuananh Jan 31 '13 at 21:56

Your Answer

 
discard

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.