PDA

View Full Version : Which folder for script that executes after computer resumes from hibernate/susp



J_Me
December 18th, 2015, 05:25 PM
I need to delete a plain text file(via a script) when the computer resumes from hibernate/suspend but I'm not sure where to put the script. Reading around the web it's been suggested to use one of these folders1 /lib/systemd/system-sleep/my-script1 /usr/lib/pm-utils/sleep.d/my-script1 1 But I don't want to mess things up so thought it best to ask here.1 1 The intended script to use1 --------------------------1 #!/bin/bash1 sleep 301 rm /tmp/my-temp-file1 ----------------------------1 1 Also it's been mentioned to name the script something like 999zzzMYfile.sh so that it executes last, rather than doing this and potentially messing with the operating system can't I just put in a 'sleep 30' and have the script wait until things have settled.1 1 Thanks

ian-weisser
December 18th, 2015, 06:43 PM
If you are really running 14.04, then you are using Upstart, not systemd.
Have you looked at the working examples in /usr/lib/pm-utils/sleep.d/ ?

Sleeping 30 seconds for the system to settle seems a bit kludgy. If you tell us what you are trying to do, we may be able to suggest another way.
If you pick an unfortunate filename, you might prevent the system from settling by blocking later tasks in the resume order.