daemons: cd to "/" before starting
commit3a08d80d2917c605339ff5611b8535449f1e4a21
authorKyle J. McKay <mackyle@gmail.com>
Sun, 30 Oct 2016 11:50:49 +0000 (30 04:50 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Sun, 30 Oct 2016 11:50:49 +0000 (30 04:50 -0700)
treeab62bf4d51d832f504de8c747c62d3adfb8842c1
parent01bc6e8eb5ee262170838916a2c3b81dd4e43970
daemons: cd to "/" before starting

While unlikely, it's possible that whatever the current working
directory is when jobd and/or taskd is started might subsequently
be removed while jobd and/or taskd is running.

If that happens, attempts to run any subcommands (such as anything
that uses the shell) are guaranteed to fail if they try to get the
current working directory.

Avoid this by just doing a "cd /" before entering any loops or starting
any long-running processes.

If the root directory somehow becomes invalid there's a much bigger
problem with the system than just jobd and/or taskd failing to function.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/jobd.pl
taskd/taskd.pl
toolbox/run-jobd.sh
toolbox/run-taskd.sh