Skip to content

Commit 6c9cc24

Browse files
committed
scripting/headless: update for new reality
See fiji/fiji#416.
1 parent 4657d24 commit 6c9cc24

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

_pages/scripting/headless.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ project: /software/imagej2
99
To start ImageJ2 headless mode, run (with the launcher appropriate for your system substituted):
1010

1111
```ssh
12-
./ImageJ-linux64 --ij2 --headless
12+
./ImageJ-linux64 --headless
1313
```
1414

1515
By default, when ImageJ2 runs headlessly it acts like a one-off program: it will only perform the requested operations, then quit. To run a script headlessly, use:
1616

1717
```ssh
18-
./ImageJ-linux64 --ij2 --headless --run path/to/script [key1=value1,key2=value2,...]
18+
./ImageJ-linux64 --headless --run path/to/script [key1=value1,key2=value2,...]
1919
```
2020

2121
{% include notice icon="warning" content='In many cases, it is necessary to enclose the entire list of key/value pairs in single quotes, to avoid shell expansion. See the following examples.' %}
@@ -33,23 +33,21 @@ print('Hello ' + name)
3333
we could run this script with the command on [Linux](/platforms/linux):
3434

3535
```ssh
36-
./ImageJ-linux64 --ij2 --headless --console --run hello.py 'name="Mr Kraken"'
36+
./ImageJ-linux64 --headless --run hello.py 'name="Mr Kraken"'
3737
```
3838

3939
Note that the `name` parameter must be enclosed in double quotes, since it is a string literal.
4040

41-
The optional `--console` argument allows to have `print`, `IJ.log` and error statements returned to the console window.
42-
4341
On [Windows](/platforms/windows) systems, single/double quotes might be inverted though, such that strings are enclosed in single quotes while the list of argument as well as the path to the py script are in double quotes.
4442

4543
```ssh
46-
ImageJ-win64.exe --ij2 --headless --console --run "PathTo/hello.py" "name='Mr Kraken'"
44+
ImageJ-win64.exe --headless --run "PathTo/hello.py" "name='Mr Kraken'"
4745
```
4846

4947
On [macOS](/platforms/macos) systems, the command can run in with the same quoting as on Linux:
5048

5149
```ssh
52-
./ImageJ-macosx --ij2 --headless --console --run hello.py 'name="Mr Kracken"'
50+
./ImageJ-macosx --headless --run hello.py 'name="Mr Kracken"'
5351
```
5452

5553
## Multiple parameters
@@ -65,22 +63,22 @@ print('Hello ' + name1 + " and " + name2)
6563
then these are filled by using a comma-separated list of parameter pairs—e.g.:
6664

6765
```ssh
68-
./ImageJ-linux64 --ij2 --headless --console --run hello.py 'name1="Mr",name2="Mrs Kraken"'
66+
./ImageJ-linux64 --headless --run hello.py 'name1="Mr",name2="Mrs Kraken"'
6967
```
7068

7169
Similarly for Windows (again respect single/double quotes) or macOS,
7270

7371
```ssh
74-
ImageJ-win64.exe --ij2 --headless --console --run "PathTo/hello.py" "name1='Mr', name2='Kraken'"
75-
./ImageJ-macosx --ij2 --headless --console --run hello.py 'name1="Mr",name2="Mrs Kraken"'
72+
ImageJ-win64.exe --headless --run "PathTo/hello.py" "name1='Mr', name2='Kraken'"
73+
./ImageJ-macosx --headless --run hello.py 'name1="Mr",name2="Mrs Kraken"'
7674
```
7775

7876
## Controlling the Updater
7977

8078
To prevent unnecessary server connections to update sites in headless mode you can set the `imagej.updater.disableAutocheck` java parameter `true`:
8179

8280
```ssh
83-
./ImageJ-linux64 -Dimagej.updater.disableAutocheck=true -- --ij2 --headless --console --run hello.py 'name="Mr Kraken"'
81+
./ImageJ-linux64 -Dimagej.updater.disableAutocheck=true -- --headless --run hello.py 'name="Mr Kraken"'
8482
```
8583

8684
Often headless mode is used to run many scripts in parallel that could result in huge numbers of server connections. Setting this parameter will prevent this issue. This parameter does not persist between launches and must be included every time server connections to update sites should be prevented.
@@ -89,7 +87,7 @@ If desired, the updater can be controlled in headless mode using the following c
8987

9088
```ssh
9189
./ImageJ-linux64 --update add-update-site BAR https://sites.imagej.net/Tiago/
92-
./ImageJ-linux64 --ij2 --headless --update update
90+
./ImageJ-linux64 --headless --update update
9391
```
9492

9593
You can also add multiple update sites in a single command line:

0 commit comments

Comments
 (0)