Added sleep <Integer> to batch commands

This commit is contained in:
Ross Scroggs
2024-02-03 17:33:36 -08:00
parent 6ed3f8ebfc
commit 566a0c0345
7 changed files with 40 additions and 8 deletions

View File

@@ -41,6 +41,7 @@ Batch files can contain the following types of lines:
* GAM waits for all running GAM commands to complete * GAM waits for all running GAM commands to complete
* GAM prints \<String\> and waits for the user to press any key * GAM prints \<String\> and waits for the user to press any key
* GAM continues * GAM continues
* sleep \<Integer\> - Batch processing will suspend for \<Integer\> seconds before the next command line is processed
* print \<String\> - Print \<String\> on stderr * print \<String\> - Print \<String\> on stderr
* set \<KeywordString\> \<ValueString\> * set \<KeywordString\> \<ValueString\>
* Subsequent lines will have %\<KeywordString\>% replaced with \<ValueString\> * Subsequent lines will have %\<KeywordString\>% replaced with \<ValueString\>

View File

@@ -11,6 +11,14 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.67.36
Updated `gam batch <BatchContent>` and `gam tbatch <BatchContent>` commands to accept lines with the following form:
```
sleep <Integer>
```
Batch processing will suspend for `<Integer>` seconds before the next command line is processed.
### 6.67.35 ### 6.67.35
Added the following options to `<PermissionMatch>` that allow more powerful matching. Added the following options to `<PermissionMatch>` that allow more powerful matching.

View File

@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.67.36 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64 MacOS Sonoma 14.2.1 x86_64
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.67.36 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
Windows-10-10.0.17134 AMD64 Windows-10-10.0.17134 AMD64

View File

@@ -4,7 +4,7 @@
Print the current version of Gam with details Print the current version of Gam with details
``` ```
gam version gam version
GAMADV-XTD3 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.67.36 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64 MacOS Sonoma 14.2.1 x86_64
@@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information Print the current version of Gam with details and time offset information
``` ```
gam version timeoffset gam version timeoffset
GAMADV-XTD3 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.67.36 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64 MacOS Sonoma 14.2.1 x86_64
@@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information Print the current version of Gam with extended details and SSL information
``` ```
gam version extended gam version extended
GAMADV-XTD3 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.67.36 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64 MacOS Sonoma 14.2.1 x86_64
@@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3 Path: /Users/Admin/bin/gamadv-xtd3
Version Check: Version Check:
Current: 5.35.08 Current: 5.35.08
Latest: 6.67.35 Latest: 6.67.36
echo $? echo $?
1 1
``` ```
@@ -73,7 +73,7 @@ echo $?
Print the current version number without details Print the current version number without details
``` ```
gam version simple gam version simple
6.67.35 6.67.36
``` ```
In Linux/MacOS you can do: In Linux/MacOS you can do:
``` ```
@@ -83,7 +83,7 @@ echo $VER
Print the current version of Gam and address of this Wiki Print the current version of Gam and address of this Wiki
``` ```
gam help gam help
GAM 6.67.35 - https://github.com/taers232c/GAMADV-XTD3 GAM 6.67.36 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64 MacOS Sonoma 14.2.1 x86_64

View File

@@ -2,6 +2,14 @@
Merged GAM-Team version Merged GAM-Team version
6.67.36
Updated `gam batch <BatchContent>` and `gam tbatch <BatchContent>` commands to accept lines with the following form:
```
sleep <Integer>
```
Batch processing will suspend for `<Integer>` seconds before the next command line is processed.
6.67.35 6.67.35
Added the following options to `<PermissionMatch>` that allow more powerful matching. Added the following options to `<PermissionMatch>` that allow more powerful matching.

View File

@@ -9681,6 +9681,10 @@ def MultiprocessGAMCommands(items, showCmds):
if item[0] == Cmd.PRINT_CMD: if item[0] == Cmd.PRINT_CMD:
batchWriteStderr(Cmd.QuotedArgumentList(item[1:])+'\n') batchWriteStderr(Cmd.QuotedArgumentList(item[1:])+'\n')
continue continue
if item[0] == Cmd.SLEEP_CMD:
batchWriteStderr(f'{currentISOformatTimeStamp()},0/{numItems},Sleepiing {item[1]} seconds\n')
time.sleep(int(item[1]))
continue
pid += 1 pid += 1
if not showCmds and ((pid % 100 == 0) or (pid == numItems)): if not showCmds and ((pid % 100 == 0) or (pid == numItems)):
batchWriteStderr(Msg.PROCESSING_ITEM_N_OF_M.format(currentISOformatTimeStamp(), pid, numItems)) batchWriteStderr(Msg.PROCESSING_ITEM_N_OF_M.format(currentISOformatTimeStamp(), pid, numItems))
@@ -9823,6 +9827,10 @@ def ThreadBatchGAMCommands(items, showCmds):
if item[0] == Cmd.PRINT_CMD: if item[0] == Cmd.PRINT_CMD:
batchWriteStderr(f'{currentISOformatTimeStamp()},0/{numItems},{Cmd.QuotedArgumentList(item[1:])}\n') batchWriteStderr(f'{currentISOformatTimeStamp()},0/{numItems},{Cmd.QuotedArgumentList(item[1:])}\n')
continue continue
if item[0] == Cmd.SLEEP_CMD:
batchWriteStderr(f'{currentISOformatTimeStamp()},0/{numItems},Sleepiing {item[1]} seconds\n')
time.sleep(int(item[1]))
continue
pid += 1 pid += 1
if not showCmds and ((pid % 100 == 0) or (pid == numItems)): if not showCmds and ((pid % 100 == 0) or (pid == numItems)):
batchWriteStderr(Msg.PROCESSING_ITEM_N_OF_M.format(currentISOformatTimeStamp(), pid, numItems)) batchWriteStderr(Msg.PROCESSING_ITEM_N_OF_M.format(currentISOformatTimeStamp(), pid, numItems))
@@ -9904,6 +9912,12 @@ def doBatch(threadBatch=False):
writeStderr(f'{ERROR_PREFIX}{Cmd.ARGUMENT_ERROR_NAMES[Cmd.ARGUMENT_INVALID][1]}: {Msg.EXPECTED} <{Cmd.CLEAR_CMD} keyword>)>\n') writeStderr(f'{ERROR_PREFIX}{Cmd.ARGUMENT_ERROR_NAMES[Cmd.ARGUMENT_INVALID][1]}: {Msg.EXPECTED} <{Cmd.CLEAR_CMD} keyword>)>\n')
errors += 1 errors += 1
continue continue
if cmd == Cmd.SLEEP_CMD:
if len(argv) != 2 or not argv[1].isdigit():
writeStderr(f'Command: >>>{Cmd.QuotedArgumentList([argv[0]])}<<< {Cmd.QuotedArgumentList(argv[1:])}\n')
writeStderr(f'{ERROR_PREFIX}{Cmd.ARGUMENT_ERROR_NAMES[Cmd.ARGUMENT_INVALID][1]}: {Msg.EXPECTED} <{Cmd.SLEEP_CMD} integer>)>\n')
errors += 1
continue
if (not cmd) or ((len(argv) == 1) and (cmd not in [Cmd.COMMIT_BATCH_CMD, Cmd.PRINT_CMD])): if (not cmd) or ((len(argv) == 1) and (cmd not in [Cmd.COMMIT_BATCH_CMD, Cmd.PRINT_CMD])):
continue continue
if cmd in validCommands: if cmd in validCommands:

View File

@@ -379,6 +379,7 @@ class GamCLArgs():
PRINT_CMD = 'print' PRINT_CMD = 'print'
SET_CMD = 'set' SET_CMD = 'set'
CLEAR_CMD = 'clear' CLEAR_CMD = 'clear'
SLEEP_CMD = 'sleep'
# Command line batch/csv/loop/tbatch keywords # Command line batch/csv/loop/tbatch keywords
BATCH_CMD = 'batch' BATCH_CMD = 'batch'
CSV_CMD = 'csv' CSV_CMD = 'csv'