[SOLVED] Using 'cat' to create files via 'pct exec'

joshy

New Member
Aug 10, 2022
3
0
1
Hi Forum,

I am trying to use cat to create a file via pct exec.

But I cannot work out the correct syntax to achieve. The folder I want to write to exists, below is the syntax I have attempted.

Code:
root@pve:~# pct exec 404 ls /etc/systemd/system/deluged.service.d
root@pve:~# pct exec 404 cat <<'EOF' > /etc/systemd/system/deluged.service.d/user.conf 
[Service] 
User=debian-deluged 
Group=debian-deluged 
EOF
-bash: /etc/systemd/system/deluged.service.d/user.conf: No such file or directory

Could I also ask what the -- means here. I have seen some examples with this. In the below both return the same data

Code:
rroot@pve:~# pct exec 404 cat /etc/hosts
root@pve:~# pct exec 404 -- cat /etc/hosts
 
pct exec ${ID} -- tee /etc/systemd/system/deluged.service.d/user.conf <<EOF
...
EOF

Works
 
Else - I'd say - use `pct push` and `pct pull` (see `man pct`)

I hope this helps!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!