[02:41:28] !log tools.meetingtimes Updating to version [02:41:30] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.meetingtimes/SAL [03:17:16] !log tools.svgtranslate Migrated to svgtranslate.toolforge.org with new OAuth consumer. [03:17:18] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.svgtranslate/SAL [09:36:56] !help how do I tell from the toolforge side if an email from a tool was sent [09:36:56] If you don't get a response in 15-30 minutes, please create a phabricator task -- https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=wmcs-kanban [09:39:05] you can't [09:39:59] if you are using our relays, we could check the logs [09:40:17] but there is no user friendly way of checling that, in general [09:41:36] arturo: I've just noticed the email has no To: header but comes to me [09:41:52] https://www.irccloud.com/pastebin/vvxUoxdI/ [09:41:56] is what I get [09:42:12] using os.system('echo -e "Subject: Test message subject\n\n' + output + '" | /usr/sbin/exim -odf -i rhinosf1+test1@gmail.com') [09:42:19] and -e isn't working as well [09:43:14] the subject is coming in the message body [09:46:18] that might be related to T120225 [09:46:19] T120225: Toolforge: correctly envelope forwarded email - https://phabricator.wikimedia.org/T120225 [09:47:58] arturo: Is there a way to get the subject to work? [09:48:15] full code is sftp://login.toolforge.org/mnt/nfs/labstore-secondary-tools-project/phabsearchemail/phab.py [09:49:03] RhinosF1: /usr/bin/mail -r "${sndr_address}" -s "Phabricator weekly project changes" ${rcpt_address} [09:49:07] this works in prod [09:49:18] syntax changed a couple times [09:49:35] i would try just using the mail command instead of exim ..maybe [09:49:40] yeah, that's the standard unix way of doing it [09:49:44] mutante: where are you putting the email content? [09:49:57] if you are using python, I'm sure there are pythonic libraries and modules for doing that natively [09:50:10] RhinosF1: cat << CONTENT CONTENT [09:50:17] EOF [09:50:29] okay [09:51:34] I suggest you do some web searching RhinosF1, there are plenty of examples all over the web [09:57:24] I found it! [10:17:52] RhinosF1: perhaps we could extend https://wikitech.wikimedia.org/wiki/Help:Toolforge/Email [10:18:42] arturo: I will post my code somewhere so we can work on it later [10:19:00] * RhinosF1 waits for his latest email to come through [10:20:22] arturo: can you see if two emails have just been sent to rhinosf1+test3@gmail.com - not seeing them come through [10:23:44] got them [12:33:26] * yuvipanda looks around [12:42:12] * arturo waves [13:19:12] How do I set a python3 script to run via jsub on cron [13:22:04] that's simpler than I thought [13:50:39] Am I right in thinking the crontab I just set up (00 14 * * 1 /usr/bin/jsub -N cron-29 -once -quiet python3 phab.py) will run weekly on a monday (starting in 10 mins) [13:50:42] arturo: ^ [13:54:52] RhinosF1: yea, it looks like weekly on Monday. I would just add that you should probably either redirect output to /dev/null or to a logfile. otherwise it will create email. not sure who will receive it though in this case [13:55:24] so called "cron spam" [13:55:28] mutante: I have no clue how to do that, if it goes to my email then the output should be just one line [13:57:32] RhinosF1: https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file [13:58:16] maybe test if you actually get the email [13:59:01] yeah, let's see what happens in 2 minutes [14:01:37] mutante: I got the email and based on cron-29.err cron-29.out showing on ls - is that happening anyway? [14:01:50] no errors! [14:02:41] !log tools.phabsearchemail set cron for '/usr/bin/jsub -N cron-29 -once -quiet python3 phab.py' to run weekly at Monday 3pm T252301 [14:02:44] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.phabsearchemail/SAL [14:02:44] T252301: Have a way to auto-email saved phab queries on a regular interval - https://phabricator.wikimedia.org/T252301 [14:04:27] RhinosF1: if it runs as your user and only you get the mail then all is fine i guess ,yea [14:05:00] mutante: I haven't had any email from cron, just the email that the script sends with the query [14:06:36] RhinosF1: 0 14 * * 1 /usr/bin/jsub -N cron-29 -once -quiet python3 phab.py >/dev/null 2>&1 [14:06:51] that would run every Monday at 14:00:00 UTC and discard the output of the script. [14:07:01] (btw, https://crontab-generator.org/ is very helpful) [14:07:24] phuzion: what makes it saves the output. It seems to be saving something to cron-29.* though anyway [14:08:04] Change >/dev/null 2>&1 to > logfile.log [14:08:11] that will overwrite logfile.log each time [14:08:23] If you want a running log that is appended automatically, change > logfile.log to >> logfile.log [14:08:54] 0 14 * * 1 /usr/bin/jsub -N cron-29 -once -quiet python3 phab.py >> logfile.log [14:09:30] However, if your script outputs a lot of text, you may wish to stick to > instead of >>, otherwise you may end up with a full volume somewhere which could break things. [14:09:51] Unless you have access to logrotate on the machine and can bzip the files up afterwards or something. [14:10:14] RhinosF1: the email thing would just happen if for whatever reason the cron fails to run [14:10:24] mutante: ah [14:10:30] 1 is normal output and 2 is error output [14:10:36] in those commands above [14:10:59] '0 14 * * 1 /usr/bin/jsub -N cron-29 -once -quiet python3 phab.py >logfile.log 2>&1' is now the cron, it outputs one line per query in the config file (so 1 line currently [14:12:16] * RhinosF1 will write some docs later [14:57:38] crontab stderr/stdout redirects in toolforge almost never do what you think they do. The only thing the cron service sees happening is the `jsub` submission. The actual work happens detached from cron's scope of control on a grid worker node [14:58:16] so the stderr/stdout redirection only applies to the jsub queue submission. [14:59:55] redirecting stderr/stdout from the running job itself has to be done with the jsub/qsub options. By default they go to the $HOME/.{out,err} log files [19:02:17] !log tools.lexeme-forms deployed ddac27d2e2 (translation update) [19:02:20] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.lexeme-forms/SAL [23:03:50] !log tools.indic-wscontest Last Update datetime should be in IST (T252479) [23:03:53] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.indic-wscontest/SAL [23:03:53] T252479: indic-wscontest: Last Update datetime should be in IST - https://phabricator.wikimedia.org/T252479