Update Useful commands authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
# xcache service unit # xcache service unit
Show status Show status
```bash ```bash
systemctl status systemd-nspawn@xcache systemctl status systemd-nspawn@xcache
``` ```
Restart Restart
```bash ```bash
systemctl restart systemd-nspawn@xcache systemctl restart systemd-nspawn@xcache
``` ```
Show logs Note: Logs are now in `/var/log/xcache` (not accessible via `journalctl` anymore)
```bash
journalctl -eu systemd-nspawn@xcache [--since ...] # container commands
```
get a shell as xrootd user in a new temporary container using the xcache image
# container commands
```bash
get a shell as xrootd user in a new temporary container using the xcache image systemd-nspawn --keep-unit --register=no -M xcache /bin/bash
```
```bash
systemd-nspawn --keep-unit --register=no -M xcache /bin/bash `/bin/bash` can also be replaced by an arbitrary command to be run. Pass `-u root` to get a root shell inside the container.
```
To run an image other than `/var/lib/machines/xcache` additional options have to be passed on the command line since it won't read `/etc/systemd/nspawn/xcache.nspawn` then, e.g.
`/bin/bash` can also be replaced by an arbitrary command to be run. Pass `-u root` to get a root shell inside the container.
```bash
To run an image other than `/var/lib/machines/xcache` additional options have to be passed on the command line since it won't read `/etc/systemd/nspawn/xcache.nspawn` then, e.g. systemd-nspawn --volatile=overlay --register=no --private-users=655360 -u xrootd -D /var/lib/machines/<some-other-image> <some-command>
```
```bash
systemd-nspawn --volatile=overlay --register=no --private-users=655360 -u xrootd -D /var/lib/machines/<some-other-image> <some-command> To get a shell in the **running** xcache container (as root, usually not nescessary)
```
```
To get a shell in the **running** xcache container (as root, usually not nescessary) nsenter --target=$(machinectl show --property Leader xcache | sed "s/^Leader=//") --all
```
```
nsenter --target=$(machinectl show --property Leader xcache | sed "s/^Leader=//") --all inside, one can then switch to a shell as the xrootd user with e.g.
```
```
inside, one can then switch to a shell as the xrootd user with e.g. su -s /bin/bash xrootd
```
```
su -s /bin/bash xrootd # Manually delete files from cache
```
This needs to be done inside the running container since it may need to clean up rucio metalink files from `dev/shm` which is currently a directory inside the container (not bind mounted).
# Manually delete files from cache
So, as root do
This needs to be done inside the running container since it may need to clean up rucio metalink files from `dev/shm` which is currently a directory inside the container (not bind mounted).
```bash
So, as root do nsenter --target=$(machinectl show --property Leader xcache | sed "s/^Leader=//") --all
```
```bash
nsenter --target=$(machinectl show --property Leader xcache | sed "s/^Leader=//") --all And then
```
```bash
And then /var/local/xcache/rm_cached_file.sh <pattern>
# e.g. to delete all files starting with AOD.05536542
```bash /var/local/xcache/rm_cached_file.sh AOD.05536542
/var/local/xcache/rm_cached_file.sh <pattern> # or all files in the mc15_13TeV scope
# e.g. to delete all files starting with AOD.05536542 /var/local/xcache/rm_cached_file.sh mc15_13TeV
/var/local/xcache/rm_cached_file.sh AOD.05536542
# or all files in the mc15_13TeV scope
/var/local/xcache/rm_cached_file.sh mc15_13TeV
``` ```
\ No newline at end of file