Hi, hi, I didn't look at the mechanics of the script too closely, but before you had shown:
flagLogDir=/home/pliggen/scripts And just now you showed: logOutput=/var/log/syslog.txt Which I glean from the error is being concatenated to: /home/pliggen/scripts//var/log/syslog.txt And that can't work if you don't first "mkdir -p /home/pliggen/scripts//var/log/" except I doubt very much you really want such a convoluted path down to the checkWeewx.log. ;-) If you want to keep the log in your home dir, you probably want: logOutput=checkWeewx.log But it will be owned by root in your home dir. I wouldn't be messing with the syslog directly, but if you want the checkWeewx.log to be next to syslog, you could do this: flagLogDir=/var/log logOutput=checkWeewx.log So if I have gleaned correctly, that will give you a log owned by root, here: /var/log/checkWeewx.log The author of the script can validate the above, if I have it right or wrong. ;-) Regards, Leon -- Leon Shaner :: Dearborn, Michigan (iPad Pro) > On Apr 30, 2019, at 5:10 PM, pliggen...@gmail.com wrote: > > Hi Leon, > > and thanks for the help! I was running my own non-root crontab. So I tried to > put the command in sudo crontab -e. > Stopped the service and tried it and now the service started as expected. > Great! And it worked with /etc/init.d/weewx start as startcommand. > I'm not sure I understood everything you wrote, I'm quite new at this, but > you made it clear what to try. > > One more question, it seems that when I run it via sudo crontab there were > some issue with the logging, > hade to remove home/pliggen/scripts from the "logDir=" line. > > Got this email message: > > sh: 1: cannot create /home/pliggen/scripts//var/log/syslog.txt: Directory > nonexistent > Starting program... > Traceback (most recent call last): > File "/var/www/html/scripts/checkWeewx/checkWeewx.py", line 159, in <module> > sendMailFailure(logDir + "/" + logOutput, config, additionalText) > File "/var/www/html/scripts/checkWeewx/checkWeewx.py", line 86, in > sendMailFailure > f = file(filename) > IOError: [Errno 2] No such file or directory: > '/home/pliggen/scripts//var/log/syslog.txt' > > > So I removed the logDir file-path so it looks like this now: > > [logging] > logDir= > logFile=checkWeewx.log > logOutput=/var/log/syslog.txt > linesToTail=200 > logToTail=/var/log/messages > logRotationDayInterval=1 > logDaysToKeep=5 > > And now I get this message in the email when the cronjob runs if the service > is stopped: > > sh: echo: I/O error > sh: echo: I/O error > Starting program... > > It doesn't matter as long as the service now seems to start but if you see > something obvious I'm glad to hear! > > Thanks, and sorry for my bad english. > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to weewx-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.