/*---------------------------------------------------------- Resets the retry delay of mail in the "forward" directory. That is, it marks the mail to be sent out immediately, which is something you might want to do after a server crash. Be warned that this might cause a huge flood of mail to be sent immediately rather than at staggered intervals. You might want to run the "listfwd" script first, and/or move some of the delayed mail temporarily into another directory to prevent it from all going out at once. Weasel SHOULD be shut down before this script is run, to avoid file access conflicts and to ensure that all waiting files are handled properly. Author: Peter Moylan (peter@pmoylan.org) based on an earlier solution by Ken Kirchner Last revised: 6 March 2019 Usage: Place this file in Weasel's "forward" mail directory. It will not scan the right directory if run from elsewhere. Then execute the command resetfwd filename to specify just one file to reset or resetfwd to process all *.fwd files in the directory ------------------------------------------------------------*/ /****************************************************************/ /* MAIN PROGRAM */ /****************************************************************/ PARSE ARG filename IF filename \= '' THEN CALL ResetFile filename ELSE DO CALL SysFileTree '*.fwd', list, 'FO' IF list.0 > 0 THEN DO i = 1 TO list.0 CALL SysSleep 1 CALL ResetFile list.i END END EXIT /****************************************************************/ /* RESET THE RETRY INFORMATION FOR A SINGLE FILE */ /****************************************************************/ ResetFile: PROCEDURE EXPOSE TNIoption MasterList. /* Caller supplies the file name, we reset the send time */ /* and retry number for that file. The flag byte is not */ /* altered. */ PARSE ARG filename IF STREAM(filename,'C','OPEN') = 'READY:' THEN DO SAY 'Resetting file 'filename prefix = CHARIN(filename,1,4) /* The first four bytes should be 'V000'. */ IF prefix = 'V000' THEN DO /* The next five bytes should be retry time and */ /* retry number, and this is what we reset. */ prefix = prefix||'0000000000'x rc = STREAM(filename,'C', 'SEEK =1') CALL CHAROUT filename, prefix rc = STREAM(filename,'C','CLOSE') END ELSE SAY ' Invalid file format' END ELSE SAY 'Failed to open 'filename RETURN /****************************************************************/