You might consider making a Stay-Open Applescript Application that sets/resets the sleep timer based on the existence of a running process. Creating a launchd plist is also a viable solution, however I'm still shaky on the syntax. The "pmset force sleep X" command doesn't require root access, but the settings are reset on reboot.
Since your situation sounds like I won't be able to anticipate your every need, I'll sketch something out for you.
property LoopTime: 5 --measured in seconds
property normalSleepTimeout: 30 --measured in minutes
property processName: "rsync" --the name of the process you're trying to find
do shell script "pmset force sleep 0" --disables sleep
if not appIsRunning() then
do shell script ("pmset force sleep " & normalSleepTimeout as string) -- sets sleep to desired idle timeout
--Here's where you need to do the test that an app is running. True needs to mean "the app is running". Store the value to "result" or change the below return statement.
For things like rsync and background processes, you'll need to get more clever and poll other functions like $ top.
set result to False
if 0 < (count of (do shell script ("top -l 1 | grep" & processName as string))) then
set result to True
Notice that in the above case, searching for just "rsync" will return a false positive if rsyncd is running because both "rsync" and "rsyncd" match. You may have to get more tricky if this doesn't work for you.
If the application were a Windowed process, I'd use the following to determine what's running:
tell application "System Events" to set RunningAppNames to name of processes
Or for bundle identifiers (more precise)
tell application "System Events" to set RunningBundles to bundle identifier of processes
Tell me more about your scenario and I'll try to write something more exact and with a more flexible user interface.