Skip to content

Commit 6075e8f

Browse files
logging raw output into logfile because for some reason rsnapshot does not log stderr in file
1 parent 8d05c58 commit 6075e8f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

rsnapshot-once.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from docopt import docopt
5353
from natsort import versorted
5454

55-
RSNAPSHOT_BINARY = "/usr/bin/rsnapshot"
55+
RSNAPSHOT_BINARY = "/usr/local/bin/rsnapshot"
5656

5757
def logf(logstring, logfile=None, prefix=""):
5858
'''Logs in rsnapshot's logfile when existing'''
@@ -303,6 +303,7 @@ def parseConfig(configpath, configfile):
303303
logft("Writing rsnapshot-once pidfile (PID "+str(PID)+") to "+PIDFILE)
304304
with open(PIDFILE, "w") as pf:
305305
pf.write(str(PID))
306+
306307
SYSCMD = RSNAPSHOT_BINARY+" -c "+ARGS.get("-c")+" "+COMMAND
307308
logft("NOW RUNNING JOB: "+SYSCMD+"\n", LOGFILE)
308309
SYSCMD = SYSCMD.split(" ")
@@ -315,8 +316,12 @@ def parseConfig(configpath, configfile):
315316
EXITCODE = retVal.returncode
316317
COMPLETEPROCESS = retVal.output
317318

318-
for LINE in COMPLETEPROCESS.split("\n"):
319-
logging.info(" rsnapshot: "+LINE)
319+
for index, LINE in enumerate(COMPLETEPROCESS.split("\n")):
320+
if index == 0:
321+
logft(" captured output: "+LINE,LOGFILE,"\n")
322+
else:
323+
logft(" captured output: "+LINE,LOGFILE)
324+
#logging.info(" captured output: "+LINE)
320325
if "rsnapshot encountered an error" in LINE:
321326
CONFIGERROR = True
322327

0 commit comments

Comments
 (0)