- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
pftool scripts
        Tom Eichlersmith edited this page Jun 4, 2025 
        ·
        3 revisions
      
    pftool has a mechanism for running rudimentary scripts of its menu commands.
./pftool -z -s script.pftool
where script.pftool is a text file that looks like
# print the daq status
daq
  status
  exit
# spy on link 0
elinks
  spy
    0
  exit
# leave pftool after we are done
exit
A few notes:
- The extra whitespace on a line is ignored by our menu's usage of readline, so I've added extra leading spaces to make the script more human readable. You can ignore it.
 - Lines started with 
#are comments and ignored by the script - Like when interacting with the menu directly, the commands are case insensitive. I've used all lower case here because I think that looks nicer, but you can choose whatever you want.
 - The last line with 
exitleavespftoolafter executing the script. If you omit this line, you will then be left with in the interactive session ofpftoollike normal. - This scripting mechanism is purposefully kept rudimentary. If you find yourself writing a lot of these scripts, you probably want to write a new command into the 
pftoolmenu instead. 
Running this script looks like
[eichl008@umn-zcu102-ldmx build]$ ./pftool -z -s script.pftool 
(2025-06-04 14:41:01) [pftool]  info: Loading ${CWD}/pftoolrc
(2025-06-04 14:41:01) [pftool]  info: connecting from ZCU in Fiberless mode
(2025-06-04 14:41:01) [pftool]  info: pflib version: 3.2.0 (v3.2.0-2-g4fa468af)
(2025-06-04 14:41:01) [pftool]  info: fw version   : ldmxfw-hcal-zcu102-20250529_120007-10dbd92.noarch
 >  daq
 >  status
          Enabled: false
          ECON ID: 4095
  Samples per RoR: 1
              SoI: 0
  Event Occupancy: 0
 >  exit
 >  elinks
 >  spy
Which elink?  [0]  0
00 accccccc
 >  exit
 >  exit