Linux restart neorouter and syncthing after sleep or hibernate

To restart a service or program after thawing or resuming from hibernation/sleep do the following. To make neorouter start at boot see this post.

Open the following folder as administrator.

/etc/pm/sleep.d

with a title that makes sense to you with the ‘sh’ extension. Use double zeros in the document name to run the service/program after all the other stuff has run.

Example:

00_neorouter_onresume.sh

In the document

#! /bin/bash

case “$1” in
thaw)
su – tech -c “/etc/init.d/nrservice.sh restart”
;;
resume)
su – tech -c “/etc/init.d/nrservice.sh restart”
;;

esac

The ‘su – tech -c ‘ sets the program to be run as su. I’m not sure why no password, other than all these files are owned by root and have root as the group.

Now make sure the file is owned by root rw and has root as the primary group.