• Shell event

    From jeff@21:1/180 to All on Sunday, August 11, 2019 11:49:54
    Hi, I'm trying to use the events system to get something to run on a
    schedule (the Puzzle of the Week). The process currently has two steps: a python script runs to generate a text file, and then mutil is used to insert the text file into a message base.

    I initially tried using a "Shell" event to do this, but it didn't seem to
    fire very consistently. The Mystic Events tab would say that the event was running, but no post was generated and both the mutil and python script logs indicated that no activity had occurred.

    Am I doing this wrong? I changed it so that cron runs the python script,
    which generates a semaphore, which then causes the mutil event to fire. I
    could do all of this from cron, of course, but I'd rather use the BBS event system.

    Thanks,
    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From Scarecrow@21:4/111 to jeff on Sunday, August 11, 2019 21:25:39
    jeff wrote to All <=-

    Am I doing this wrong? I changed it so that cron runs the python
    script, which generates a semaphore, which then causes the mutil event
    to fire. I could do all of this from cron, of course, but I'd rather
    use the BBS event system.

    I had similar problems with the event system. The Shell, and often the Interval, types seemed to go on hiatus randomly for me. Except for a
    couple Semaphore events, I'm running everything via cron like you, with
    the scripts creating the semaphore flags. Other BBS housekeeping and
    security related tasks are handled entirely by cron independently of
    the BBS.

    ... Alimony is like buying oats for a dead horse
    ___ MultiMail/Win v0.52
    --- Mystic BBS/QWK v1.12 A43 2019/03/02 (Linux/32)

    * Origin: Blue Northern Software | bnsbbs.ddns.net:23000 (21:4/111)
  • From Avon@21:1/101 to jeff on Monday, August 12, 2019 20:06:33
    On 11 Aug 2019 at 11:49a, jeff pondered and said...

    Hi, I'm trying to use the events system to get something to run on a schedule (the Puzzle of the Week). The process currently has two steps: a python script runs to generate a text file, and then mutil is used to insert the text file into a message base.

    OK sounds like a plan :)

    I initially tried using a "Shell" event to do this, but it didn't seem to fire very consistently. The Mystic Events tab would say that the event
    was running, but no post was generated and both the mutil and python script logs indicated that no activity had occurred.

    First up are you looking to run something at a set time, once a week? If yes, then a shell event would be my pick and you would set it up for let's say Monday at 2.15am and have the rest of the days set to No

    [snip]

    ßßßßßßßßßßßßßßßßßßßßßß Event ID 19 ßßßßßßßßßßßßßßßßßßßßßßÜ
    Û
    Active ³ Yes Û
    Description ³ Weekly Puzzle Sun ³ No Û
    Event Type ³ Shell Mon ³ Yes Û
    Exec Hour ³ 2 Tue ³ No Û
    Exec Min ³ 15 Wed ³ No Û
    Shell ³ ./puzzle.sh|./mutil puzzle.ini Thu ³ No Û
    Semaphore ³ Fri ³ No Û
    Kill After ³ Sat ³ No Û
    Warning ³ 0 Û
    Û ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÛ

    [snip]

    This assumes that:

    - your puzzle.sh script sits in the mystic directory
    - your puzzle.sh script has correct read/write/execute permissions set so it will run and create a text file as output
    - you have a .ini file called puzzle.ini in your mystic directory
    - inside that .ini you have a [PostTextFiles] stanza enabled
    - the stanza function points to the correct file path and file to be posted
    - the stanza function sets the number of files to be posted correctly,
    usually 1
    - the rest of the info against file1_xxx config options are correct

    e.g.

    [snip]

    [General]

    ; list of functions to perform on startup


    PostTextFiles = true

    logfile=mutil.log

    ; Level 1 = basic
    ; Level 2 = verbose
    ; Level 3 = debug

    loglevel=3

    ; Log roller type 0=roll by number of files/size 1=roll by number of days
    logtype = 1

    ; number of log files to keep (0 to disable log rolling)
    maxlogfiles = 7

    ; size of each log file in kilobytes
    maxlogsize = 10000


    ; ==========================================================================
    ; ==========================================================================
    ; ==========================================================================

    [PostTextFiles]

    ; Total number of text files to be posted. For each file there needs to
    ; be a file definition as show below.

    totalfiles = 1

    file1_name = /home/pi/mystic/puzzle.txt
    file1_baseidx = 9
    file1_from = Perceptronica BBS
    file1_to = All
    file1_subj = Puzzle of the Week
    file1_addr = 21:1/180
    file1_delfile = true

    [snip]

    The baseidx would link to your base ID for the base you are trying to post to.

    Am I doing this wrong? I changed it so that cron runs the python script,

    Well it could be a few things. Incorrect pathing, incorrect file name etc.

    What do the MIS logs show when the event runs? Can you paste it up here?

    Best, Paul

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From jeff@21:1/180 to Avon on Monday, August 12, 2019 12:44:54
    On 12 Aug 2019, Avon said the following...
    First up are you looking to run something at a set time, once a week? If yes, then a shell event would be my pick and you would set it up for
    let's say Monday at 2.15am and have the rest of the days set to No
    Yes, once a week, ideally. However, for testing purposes I have it set up for the day I'm testing (currently Monday) and then I set the time to a few
    minutes in the future.

    - your puzzle.sh script sits in the mystic directory
    Correct.
    - your puzzle.sh script has correct read/write/execute permissions set
    so it will run and create a text file as output
    Correct. It successfully executes from cron.

    - you have a .ini file called puzzle.ini in your mystic directory
    - inside that .ini you have a [PostTextFiles] stanza enabled
    - the stanza function points to the correct file path and file to be posted - the stanza function sets the number of files to be posted correctly, usually 1
    - the rest of the info against file1_xxx config options are correct
    Correct. The post is successfully created when invoking mutil with this .ini file from either the command line or from a Semaphore event.

    What do the MIS logs show when the event runs? Can you paste it up here?
    The MIS log doesn't show anything; it's as if the event never happened.

    I copied the existing .ini file to a new one and made two changes: I changed the message base to a local one (to avoid spamming anyone), and I upped the
    log level to 3. Then I created a new Shell event to run the puzzle script and then run mutil with the new .ini file. I set it to run in about 10 minutes, exited the event editor, and restarted mis. I could tell from the server message "Starting 7 event(s)" that it picked up the new event. About 10
    minutes later, the event fired and a new puzzle was posted to the local
    message base.

    So then I went back into the event editor and changed the Exec Min field to about 2 minutes in the future and restarted mis. On the Events tab, the countdown to the new Exec Min was reflected. The time came and passed, but it seems like the event never fired. There was no update to any log; the python script was not run. I tried again, setting the Exec Min to 10 minutes out,
    but again it did not fire.

    I edited the new event and zeroed out the Exec Hour, set the Exec Min to 1,
    and changed the event type to interval. I didn't change the commands to be executed. Three minutes later, I had three new puzzles in the local message base.

    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From Avon@21:1/101 to jeff on Tuesday, August 13, 2019 19:57:19
    On 12 Aug 2019 at 12:44p, jeff pondered and said...

    I copied the existing .ini file to a new one and made two changes: I changed the message base to a local one (to avoid spamming anyone), and
    I upped the log level to 3. Then I created a new Shell event to run the puzzle script and then run mutil with the new .ini file. I set it to run in about 10 minutes, exited the event editor, and restarted mis. I could tell from the server message "Starting 7 event(s)" that it picked up the new event. About 10 minutes later, the event fired and a new puzzle was posted to the local message base.

    OK so perhaps it was something related to the 'old' event and removing it and recreating it would help fix this.

    The fact the above is working tells me things are on the right track.

    Can you share the shell line syntax you used or better still just paste a
    copy of the screen settings here?

    Your MIS will have recorded this event running as all events are logged using an EVENT class. Here's an example from 21:1/100

    + 2019.08.13 16:37:10 EVENT Running event: Toss incoming
    + 2019.08.13 16:37:10 EVENT Cmd: mutil mailin.ini
    + 2019.08.13 16:37:11 EVENT Res: 0
    + 2019.08.13 16:37:11 EVENT Cmd: fidopoll 21:2/100
    + 2019.08.13 16:37:14 EVENT Res: 0
    + 2019.08.13 16:37:14 EVENT Cmd: fidopoll 21:3/100
    + 2019.08.13 16:37:15 EVENT Res: 0

    Note the Res:0 - this indicates a result code of 0 which is good, it means
    the command ran just fine. If something is amiss with the shell line not running correctly you will see different error codes there start to appear.


    So then I went back into the event editor and changed the Exec Min field to about 2 minutes in the future and restarted mis. On the Events tab,
    the countdown to the new Exec Min was reflected. The time came and
    passed, but it seems like the event never fired. There was no update to any log; the python script was not run. I tried again, setting the Exec Min to 10 minutes out, but again it did not fire.

    what sort of event were you testing?

    I edited the new event and zeroed out the Exec Hour, set the Exec Min to 1, and changed the event type to interval. I didn't change the commands
    to be executed. Three minutes later, I had three new puzzles in the
    local message base.

    That kind of confounds things a bit as you changed event timing and event
    type. Better to stick with one change to time and leave the event type alone.


    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)

    Best, Paul

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From jeff@21:1/180 to Avon on Tuesday, August 13, 2019 09:29:10
    On 13 Aug 2019, Avon said the following...
    Can you share the shell line syntax you used or better still just paste a copy of the screen settings here?
    No, I can't seem to copy the screen as text.
    The Shell line is:
    /home/jeff/projects/cryptopuzzle/potw|/home/jeff/bbs/mutil potwtest.ini

    Your MIS will have recorded this event running as all events are logged using an EVENT class. Here's an example from 21:1/100
    For whatever reason, it didn't. There's just no entry in the mis.log for the time at which the event should have run. Also, watching the event tab of the mis console, the entry in the TIME column goes from "0d 0h 1m" to "Running" to "Now" to "6d 23h 59m" when the event fires. When the event does not fire, the entry in the TIME column goes from "0d 0h 1m" to "Now" to "6d 23h 59m".

    The "Nightly maintenance" event, which is also a Shell event, has so far been firing without fail. I'm never logged in at 4am, so I thought maybe being logged in would inhibit the event, but this turned out not to be the cause of the Puzzle failures.

    what sort of event were you testing?
    I made a new Shell event, "Puzzle of the Week TEST", which uses potwtest.ini, which is identical to the potw.ini used by the "Puzzle of the Week" event, except that it has a higher logging level and posts to a local message base rather than the fsxNet one.

    That kind of confounds things a bit as you changed event timing and event type. Better to stick with one change to time and leave the event type alone.
    However, it does give me confidence that the Shell line syntax is correct and can be invoked repeatedly.

    Yesterday when I stopped working on it, I'd left the test event as an
    Interval and disabled it. This morning, I changed it back to a Shell event, set a time for a couple of minutes in the future, re-enabled it, and
    restarted mis. It fired once, on schedule. Resetting the time and
    restarting mis again, it would not fire. I tried setting it for a
    future time, disabling it, restarting mis, re-enabling it, and restarting mis again, but it did not fire.

    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From jeff@21:1/180 to Avon on Tuesday, August 13, 2019 15:44:00
    On 13 Aug 2019, jeff said the following...
    For whatever reason, it didn't. There's just no entry in the mis.log for the time at which the event should have run. Also, watching the event
    tab of the mis console, the entry in the TIME column goes from "0d 0h
    1m" to "Running" to "Now" to "6d 23h 59m" when the event fires. When the event does not fire, the entry in the TIME column goes from "0d 0h 1m"
    to "Now" to "6d 23h 59m".
    Also, when the event should fire but doesn't, the LAST EXECUTED column is not updated. It shows the time of the last successful execution or a 1970 date if it has never executed successfully.

    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From Avon@21:1/101 to jeff on Wednesday, August 14, 2019 13:36:53
    On 13 Aug 2019 at 09:29a, jeff pondered and said...

    The Shell line is: /home/jeff/projects/cryptopuzzle/potw|/home/jeff/bbs/mutil potwtest.ini

    Can I suggest putting the potw.sh script in the /bbs directory with the
    Mystic files.. and instead of specifying a full path just try this for the shell line.

    ./potw.sh|./mutil potwtest.ini


    Your MIS will have recorded this event running as all events are logg using an EVENT class. Here's an example from 21:1/100
    For whatever reason, it didn't. There's just no entry in the mis.log for the time at which the event should have run. Also, watching the event

    Which tells me nothing is running..

    The "Nightly maintenance" event, which is also a Shell event, has so far been firing without fail. I'm never logged in at 4am, so I thought maybe being logged in would inhibit the event, but this turned out not to be
    the cause of the Puzzle failures.

    When you say it's working, do you see MIS logging for this to confirm
    something is being recorded as having happened?

    What is the shell syntax for that event?

    what sort of event were you testing?
    I made a new Shell event, "Puzzle of the Week TEST", which uses potwtest.ini, which is identical to the potw.ini used by the "Puzzle of the Week" event, except that it has a higher logging level and posts to
    a local message base rather than the fsxNet one.

    OK

    Yesterday when I stopped working on it, I'd left the test event as an Interval and disabled it. This morning, I changed it back to a Shell event, set a time for a couple of minutes in the future, re-enabled it, and restarted mis. It fired once, on schedule. Resetting the time and restarting mis again, it would not fire. I tried setting it for a
    future time, disabling it, restarting mis, re-enabling it, and
    restarting mis again, but it did not fire.

    ..and the time you were attempting to get this event to fire on for it's second, third occasions was some minutes later after the first successful event? e.g. first event 1:25 second event 1:30 and third event 1:36 ?? sort
    of thing?

    ..and it was a shell event, untouched except for time... and you had closed
    and restarted MIS?

    I think when you make changes to events it's a good idea to first close MIS, then make the change in config, close config, then restart MIS.. doing otherwise can risk some changes not being applied to MIS

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Avon@21:1/101 to jeff on Wednesday, August 14, 2019 13:41:33
    On 13 Aug 2019 at 03:44p, jeff pondered and said...

    the time at which the event should have run. Also, watching the event tab of the mis console, the entry in the TIME column goes from "0d 0h 1m" to "Running" to "Now" to "6d 23h 59m" when the event fires. When event does not fire, the entry in the TIME column goes from "0d 0h 1m to "Now" to "6d 23h 59m".

    Yep it's certainly not running - I agree... but when that next happens watch the main logging screen in MIS and let me know what you see (or not) display
    as an EVENT type during the time the event should be firing / running.

    I am suspicious that the shell line syntax is not correct somehow or the
    script being called is not executable from within the directory your copy of mystic is running in.

    ..and you have it in a directory called \bbs\ not \mystic\ - just checking :)

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From jeff@21:1/180 to Avon on Tuesday, August 13, 2019 21:53:12

    On 14 Aug 2019, Avon said the following...
    Can I suggest putting the potw.sh script in the /bbs directory with the Mystic files.. and instead of specifying a full path just try this for
    the shell line.

    ./potw.sh|./mutil potwtest.ini
    I just tried this... no luck. I shut down mis, made the change, and restarted mis (but didn't log off first). The end of the log has a row of ------- where the restart occurred, the TELNET servers starting up, the BINKP servers starting up, a message about Cryptlib not being detected, a notice about starting 7 event(s), and a message about resetting ghost node 1 (because I didn't log off first. The even should have run 2 minutes later, but that's
    the end of the log.

    Let me save this as a draft and try again, this time logging off...

    Nope, it didn't fire. There's no mention of it in the log and the LAST
    EXECUTED time did not update.

    This is the potw script in the bbs directory:
    #!/bin/bash
    cd /home/jeff/projects/cryptopuzzle
    ./cryptopuzzle.py
    cp PotW.txt /home/jeff/bbs
    touch /home/jeff/bbs/semaphore/potw.out

    (This script is currently shared by both the test and "real" events. The
    "real" event is kicked off by cron, creates the semaphore, and then a
    Semaphore event posts the PotW.txt file to fsxNet. If the test event fires,
    it does cause the Semaphore event to fire, but by then the PotW.txt file
    has been deleted and there's nothing to post.)

    Which tells me nothing is running..
    That is my assessment as well.

    When you say it's working, do you see MIS logging for this to confirm something is being recorded as having happened?
    Yes. There are three lines in the log at about 4am: a notification that it's running the event, the Cmd being run, and a Res of 0. Also the LAST EXECUTED time is 13 Aug 2019 04:02.

    What is the shell syntax for that event?
    /home/jeff/bbs/mutil maint.ini
    (I set up the BBS watching your YouTube videos.)

    ..and the time you were attempting to get this event to fire on for it's second, third occasions was some minutes later after the first successful event? e.g. first event 1:25 second event 1:30 and third event 1:36 ?? sort of thing?
    Exactly that sort of thing.

    ..and it was a shell event, untouched except for time... and you had closed and restarted MIS?
    Correct.

    I think when you make changes to events it's a good idea to first close MIS, then make the change in config, close config, then restart MIS.. doing otherwise can risk some changes not being applied to MIS
    Ok. I did follow this procedure earlier in the message.

    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From jeff@21:1/180 to Avon on Tuesday, August 13, 2019 21:58:29
    On 14 Aug 2019, Avon said the following...
    Yep it's certainly not running - I agree... but when that next happens watch the main logging screen in MIS and let me know what you see (or
    not) display as an EVENT type during the time the event should be firing
    / running.
    There are no EVENT messages in the log for when the event is supposed to be running.

    I am suspicious that the shell line syntax is not correct somehow or the script being called is not executable from within the directory your
    copy of mystic is running in.
    This was the purpose behind seeing if I could run it as an Interval event... and I can.

    ..and you have it in a directory called \bbs\ not \mystic\ - just
    checking :)
    Correct.

    Thanks,
    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)
  • From Avon@21:1/101 to jeff on Friday, August 16, 2019 15:52:20
    On 13 Aug 2019 at 09:58p, jeff pondered and said...

    Yep it's certainly not running - I agree... but when that next happen watch the main logging screen in MIS and let me know what you see (or not) display as an EVENT type during the time the event should be fir / running.
    There are no EVENT messages in the log for when the event is supposed to be running.

    OK so nothing firing then nor showing on the screen...

    I am suspicious that the shell line syntax is not correct somehow or script being called is not executable from within the directory your copy of mystic is running in.
    This was the purpose behind seeing if I could run it as an Interval event... and I can.

    So it runs reliably as Interval? Be good to test, then when done, perhaps
    also test hourly....


    ..and you have it in a directory called \bbs\ not \mystic\ - just checking :)
    Correct.

    coolio

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Avon@21:1/101 to jeff on Friday, August 16, 2019 15:57:40
    On 13 Aug 2019 at 09:53p, jeff pondered and said...

    Can I suggest putting the potw.sh script in the /bbs directory with t Mystic files.. and instead of specifying a full path just try this fo the shell line.

    ./potw.sh|./mutil potwtest.ini
    I just tried this... no luck. I shut down mis, made the change, and restarted mis (but didn't log off first). The end of the log has a row
    of ------- where the restart occurred, the TELNET servers starting up,
    the BINKP servers starting up, a message about Cryptlib not being detected, a notice about starting 7 event(s), and a message about resetting ghost node 1 (because I didn't log off first. The even should have run 2 minutes later, but that's the end of the log.


    question - are you running MIS in daemon mode or MIS Server?

    Let me save this as a draft and try again, this time logging off...

    Nope, it didn't fire. There's no mention of it in the log and the LAST EXECUTED time did not update.

    That is weird... yep I wonder what is up.

    This is the potw script in the bbs directory:
    #!/bin/bash
    cd /home/jeff/projects/cryptopuzzle
    ./cryptopuzzle.py
    cp PotW.txt /home/jeff/bbs
    touch /home/jeff/bbs/semaphore/potw.out

    (This script is currently shared by both the test and "real" events. The "real" event is kicked off by cron, creates the semaphore, and then a Semaphore event posts the PotW.txt file to fsxNet. If the test event fires, it does cause the Semaphore event to fire, but by then the
    PotW.txt file has been deleted and there's nothing to post.)

    running this manually from within the directory the script resides works ok?

    When you say it's working, do you see MIS logging for this to confirm something is being recorded as having happened?
    Yes. There are three lines in the log at about 4am: a notification that it's running the event, the Cmd being run, and a Res of 0. Also the LAST EXECUTED time is 13 Aug 2019 04:02.

    good, this is as it should be.

    What is the shell syntax for that event?
    /home/jeff/bbs/mutil maint.ini
    (I set up the BBS watching your YouTube videos.)

    coolio

    second, third occasions was some minutes later after the first succes event? e.g. first event 1:25 second event 1:30 and third event 1:36 sort of thing?
    Exactly that sort of thing.
    ..and it was a shell event, untouched except for time... and you had closed and restarted MIS?
    Correct.

    OK thanks

    I think when you make changes to events it's a good idea to first clo MIS, then make the change in config, close config, then restart MIS.. doing otherwise can risk some changes not being applied to MIS
    Ok. I did follow this procedure earlier in the message.

    that's good, yep always worth doing this, I have been caught before making changes to events that don't stick otherwise.

    --- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From jeff@21:1/180 to Avon on Friday, August 16, 2019 06:33:51
    On 16 Aug 2019, Avon said the following...
    question - are you running MIS in daemon mode or MIS Server?
    I'm running it in server mode. I'm also running it in a screen session. If you're not familiar with screen, it's primarily a program that allows you to run multiple sessions in one terminal window, but it also continues to run if that terminal window is closed; the programs running in each of the sessions still think they're connected to a terminal. And then it can be "reattached"
    to a different terminal window at a later time.

    Jeff.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: Perceptronica (21:1/180)