1

I often run long calculations on my computer and I would like to shut it down when this are terminated.

Is there some option to shutdown the computer when a specific process termanates? Thanks for the help!

lucacerone
  • 1,721

2 Answers2

2

This should do the trick:

http://www.makeuseof.com/tag/cuttlefish-set-actions-reactions-automate-ubuntu/

Mrokii
  • 502
0

I don't know any out-of-the-box solution for this, but you could make cron check if the process is still there every hour or so. You could put something like this in a suitable place chmod it executable by root and symlink to it from /etc/cron.hourly :

#!/bin/bash
PROCESSNUM = `ps x | grep -c "calculationthingy"` 
if [ "$PROCESSNUM" -lt 1 ] 
then
    # Make sure this in inactivated! 
    rm symlink_in_etc_hourly
    shutdown -h now 
fi
Hinz
  • 592